My application is written in Java (J2SE) and was originally designed for a Windows environment. It was written on a Windows OS. I am now trying to figure out how to get the application to run on Ubuntu 10.04 LTS and have no idea where to start. I have multiple supporting libraries (.jar files) that I have no idea how to package together for linux. Much less how to create any type of executable. I know that an .exe file will not work and I cannot use WINE.
I also have the issue of different file paths. I have some hardcoded paths (C:\folder\xxx.txt) and need to change them so the application can write and read to them on either OS. Not sure how to proceed with this one either other than testing for a specific OS and changing the paths accordingly.
Making this all more complicated is the fact that my Linux experience is very limited.
First, get some familiarity with how applications are used on Linux. It will make the process easier, and will help you do a good job.
Secondly, remove any hardcoded paths of any kind from your source code. All paths should be specified by the user, or at very least stored in a
.propertiesfile and read in at run time. This is good practice even if you are only targeting one OS: why do you expect that your users are OK with you putting a new folder in their C: drive on Windows?As for where your files go, the easiest way to deal with this is to create a single tarball (tar.gz archive) containing all your JARs and other resources, and a single Bourne shell script called by the name of your program (with no extension). The script can find the JARs and launch the
javaexecutable (which is usually under/usr/bin/java) to start your application.You’ll probably get more help if you ask specific questions about specific steps of the problem. If you’re just looking for things like where the appropriate folders are located, then the correct place is probably unix.stackexchange.com; if you need user-level help, then askubuntu.com is probably the right place.