techPowerUp! Forums

Go Back   techPowerUp! Forums > Software > Programming & Webmastering

Reply
 
Thread Tools
Old May 9, 2011, 06:48 PM   #1
Aleksander
2000 Posts
 
Aleksander's Avatar
 
Join Date: Dec 2009
Posts: 3,038 (2.35/day)
Thanks: 653
Thanked 283 Times in 229 Posts

System Specs

.java to .jar file

Hi guys!
I have a problem i think i dont know how to do this little thing
I have searched around the web, but i cant find anyone to explain it how to
and where to put this code down here in order for the compilator to convert it
from .java to a .jar file so the program or games i do in neatbeans can be executed in
my mobile phone!
Anyone can help??? The code is this one:
jar cf jar-file input-file(s)
Aleksander is offline  
Reply With Quote
Old May 9, 2011, 06:53 PM   #2
digibucc
3500 Posts
 
digibucc's Avatar
 
Join Date: May 2009
Location: In the mountains :) Adirondacks in NY (US)
Posts: 3,709 (2.49/day)
Thanks: 4,547
Thanked 1,449 Times in 1,040 Posts

System Specs

well you'd put in in your command prompt, from wherever it can execute the java compiler.

if installed correctly, that should be anywhere. but you may have to navigate to the java install directory to call the executable.

i have no idea about java specifically, so i can't help much more than that i'm afraid.

you might want to mention windows or linux, as that will matter. i assume windows?
__________________

Donate to TPU TeamSpeak Server

TPU TS: ts21.gameservers.com:9207

PSN / XBL / Steam = digibucc | Origin / BF3 = digibuc
digibucc is offline  
Reply With Quote
Old May 9, 2011, 06:57 PM   #3
Aleksander
2000 Posts
 
Aleksander's Avatar
 
Join Date: Dec 2009
Posts: 3,038 (2.35/day)
Thanks: 653
Thanked 283 Times in 229 Posts

System Specs

I have already posted windows in my system specs
Aleksander is offline  
Reply With Quote
Old May 9, 2011, 07:01 PM   #4
robn
75 Posts
 
robn's Avatar
 
Join Date: Mar 2010
Location: UK
Posts: 177 (0.15/day)
Thanks: 292
Thanked 67 Times in 48 Posts

System Specs

Netbeans is the same on all OSs: Right-click on your project and choose "clean & build". The Jar executable will be made and put in the "dist" sub folder of your project.
robn is offline  
Reply With Quote
Old May 9, 2011, 07:07 PM   #5
Easy Rhino
Linux Advocate
 
Easy Rhino's Avatar
 
Join Date: Nov 2006
Posts: 10,284 (4.27/day)
Thanks: 1,219
Thanked 2,789 Times in 1,801 Posts

System Specs

Quote:
Originally Posted by Aleksander Dishnica View Post
I have searched around the web, but i cant find anyone to explain it how to
and where to put this code down here in order for the compilator to convert it
from .java to a .jar file s
http://download.oracle.com/javase/1....laris/jar.html

obviously didnt look to hard
Easy Rhino is offline  
Reply With Quote
Old May 9, 2011, 07:12 PM   #6
Aleksander
2000 Posts
 
Aleksander's Avatar
 
Join Date: Dec 2009
Posts: 3,038 (2.35/day)
Thanks: 653
Thanked 283 Times in 229 Posts

System Specs

I know the manual, i got the code from there
I just dont know where to put the code in the program i made
and what to put in :S?
Aleksander is offline  
Reply With Quote
Old May 9, 2011, 07:14 PM   #7
Easy Rhino
Linux Advocate
 
Easy Rhino's Avatar
 
Join Date: Nov 2006
Posts: 10,284 (4.27/day)
Thanks: 1,219
Thanked 2,789 Times in 1,801 Posts

System Specs

if you know the manual then you know you dont put the code in the program, you convert all of your java class files into a jar file using their compiler.
Easy Rhino is offline  
Reply With Quote
Old May 9, 2011, 07:14 PM   #8
temp02
200 Posts
 
Join Date: Mar 2009
Posts: 490 (0.32/day)
Thanks: 0
Thanked 171 Times in 158 Posts

As a side note to Easy Rhinos comment, you can only jar .class files, meaning that you need to compile all the .java files and them jar the .class files resulting from the compilation. Example:
Code:
javac Test.java
jar cf Teste.jar Test.class
temp02 is offline  
Reply With Quote
The Following User Says Thank You to temp02 For This Useful Post:
Old May 9, 2011, 07:21 PM   #9
Aleksander
2000 Posts
 
Aleksander's Avatar
 
Join Date: Dec 2009
Posts: 3,038 (2.35/day)
Thanks: 653
Thanked 283 Times in 229 Posts

System Specs

Ok, but where to put the code?
I mean in a new class? In the middle of a class?
And inside are so many classes, which means with your code man, i need to put all in???
Or should i create the code again and again?
Aleksander is offline  
Reply With Quote
Old May 9, 2011, 07:22 PM   #10
robn
75 Posts
 
robn's Avatar
 
Join Date: Mar 2010
Location: UK
Posts: 177 (0.15/day)
Thanks: 292
Thanked 67 Times in 48 Posts

System Specs

Quote:
Originally Posted by Aleksander Dishnica View Post
I know the manual, i got the code from there
I just dont know where to put the code in the program i made
and what to put in :S?
Code goes on a command line prompt as already mentioned...

but anyway since you are using Netbeans, it will sort all this for you as I already said

"Clean & build" project = jar file
robn is offline  
Reply With Quote
Old May 9, 2011, 07:22 PM   #11
Easy Rhino
Linux Advocate
 
Easy Rhino's Avatar
 
Join Date: Nov 2006
Posts: 10,284 (4.27/day)
Thanks: 1,219
Thanked 2,789 Times in 1,801 Posts

System Specs

you can either use the command line or whatever program you may have used to write the program.
Easy Rhino is offline  
Reply With Quote
Old May 9, 2011, 07:32 PM   #12
temp02
200 Posts
 
Join Date: Mar 2009
Posts: 490 (0.32/day)
Thanks: 0
Thanked 171 Times in 158 Posts

Quote:
Originally Posted by Aleksander Dishnica View Post
Ok, but where to put the code?
I mean in a new class? In the middle of a class?
And inside are so many classes, which means with your code man, i need to put all in???
Or should i create the code again and again?
Yes, you need to compile every single file, and moreover, if one files has dependencies that cannot be solved automatically (the class is not in java.lang.path) you have to include the path to every unresolved class at the compilation process command line.
If I were you, for a big standalone application I would follow robn advice and use NetBeans to manage all the files in a projects, and let NetBeans/Ant figure out how to properly compile and build the jar (if you do use NetBeans the resulting jar file will be inside the dist folder inside the project folder).
temp02 is offline  
Reply With Quote
The Following User Says Thank You to temp02 For This Useful Post:
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How can i extract a bios file from an Asus .exe file ?? Jonny_doe AMD / ATI 38 Aug 8, 2011 06:51 AM
[Case Gallery] Jar.IT lutvi Case Mod Gallery 5 Nov 19, 2010 06:26 AM
Problem saving Asus bios version 1009 as ROM file, autosaves as AMI file. tepabajo Motherboards & Memory 2 Jan 2, 2006 10:23 PM


All times are GMT. The time now is 09:13 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
no new posts