Tuesday, July 24, 2012

Deployment of NetBeans Project in Linux

Recently I am developing a java Application to Organize my Desktop and move files to particular folder as per file type in Net-beans for Linux. After developing Application i started thinking that in Windows visual studio provide facility to build and directly generate *.exe file so it run by double clicking but what about Linux so here is the solution


note: I am using Linux mint 12 so if you face problem to follow steps listed below please notify me 


Step 1: Set your starting frame by right clicking on project and go to properties->Run 
Select your Main Class by Browsing...


Step 2:To Build Your Application go to Run->Clean And Build Project (Check your project name)
So that .jar file will be generated in home/NetBeansProject/"your project"/dist

Step 3:If you want to Deploy your Application on other Users too then you have to take care of file operations


Step 4: Now to run jar file from terminal command "java -jar filename.jar" 
if command doesn't work then reinstall 'jre'
If your application need prerequisite files and you subjecting your file by current path problem arises in deployment are
  • What if it deploy on other's PC
  • What after .jar file generate then what happen to current path
If we run jar file from terminal it will treat home folder as current path
Ex:- In my application I refer some files "doc.cat,img.cat " for categories of file so i created it in project folder now when i run through terminal i have to put that file in home folder


If your application run correctly via terminal through command then to run application by double clicking


Step 5: Create launcher right click on desktop and select create launcher give information as below
Type: Application
Name: Give Any Name
Command: "java -jar filename.jar"
Click on Ok


Note: If you are using mint 12 then no option appear for create launcher follow article no 1b on below link to fix that problem
http://forums.linuxmint.com/viewtopic.php?t=86813

Desktop organizer for linux :- http://www.mediafire.com/?swr3w4yde2owx91

No comments:

Post a Comment