Fractal Softworks Forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

Starsector 0.97a is out! (02/02/24); New blog post: Simulator Enhancements (03/13/24)

Author Topic: Java question: which java files need to be compiled?  (Read 2280 times)

rogerbacon

  • Commander
  • ***
  • Posts: 142
    • View Profile
Java question: which java files need to be compiled?
« on: January 01, 2016, 03:14:39 PM »

I made some changes to missions and the changes showed up in the game so I figured out they don't need to be complied.  Which java files must be compiled and which ones can I leave uncompiled?
« Last Edit: January 01, 2016, 03:19:56 PM by rogerbacon »
Logged

Snrasha

  • Admiral
  • *****
  • Posts: 705
    • View Profile
Re: Java question: which java files need to be compiled?
« Reply #1 on: January 01, 2016, 04:28:54 PM »

When you compile, you can delete all file except .JAR and also, you need compile for advanced script.

This thing is impossible without compile for you:
catch (NoSuchMethodException | SecurityException | IllegalAccessException | IllegalArgumentException | InvocationTargetException ex) { 
Logged
I am pretty bad on english. So, sorry in advance.

Gladiator Society
Add battle options on Com Relay/ Framework for modders for add their own bounty.

Sanguinary Autonomist Defectors A fan-mod of Shadowyard.

mendonca

  • Global Moderator
  • Admiral
  • *****
  • Posts: 1159
    • View Profile
Re: Java question: which java files need to be compiled?
« Reply #2 on: January 02, 2016, 12:25:18 AM »

I've been having lots of fun with this recently ...

Essentially, none of the .java files you'd typically put in a mod would need to be compiled. What will happen is that Janino will compile them for you on game start. Which is the problem. Janino can't work with some key Java concepts, and sometimes throws errors with code that WOULD work but Janino doesn't want to compile.

It really comes down to what level of functionality you need from your mod, and also how big it is (compiled code will load in to the game faster).

I've only just made the transition to compiled code (thanks to help from MesoTronik) so you can do most vanilla things before it becomes an issue (look at .java files in junk pirates 2.4) but if you know how, you probably should compile anyway - then you never need worry about the Janino thing.
Logged


"I'm doing it, I'm making them purple! No one can stop me!"

kazi

  • Admiral
  • *****
  • Posts: 714
    • View Profile
Re: Java question: which java files need to be compiled?
« Reply #3 on: January 02, 2016, 01:34:19 AM »

The only real files that require compiling are those that use generics (Janino doesn't support these). What's a generic? Generally anything that looks like <this>.

You really have nothing to lose by compiling your code, except for the fact that your mod will load faster. It also lets you get compiler error messages from your IDE, which is infinitely more informative than trying to boot/reboot Starsector to fix a bug.
Logged