• Post Reply Bookmark Topic Watch Topic
  • New Topic

viewing a source code from jar or xml  RSS feed

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Greetings,

I am trying to view a source code for the physics simulation provided in the following website:

http://www.opensourcephysics.org/items/detail.cfm?ID=8691

when I unzipped it, I see xml file instead java code. I attempted another way by typing

jar xf ejs_mech_orbits_CLassicalHelium.jar

It gives me more information but still there is no actual source code of this program.
Am I missing something or there should be no source code at all therefore I am looking at the wrong place?
Or there is a way. How do I get java source code from jar file or xml file?

Also, I noticed that when I run java from eclipse, it runs a lot slower than running the same simulation from terminal and typing java -jar simulation.jar etc. Why is that? Is there a way to speed it up?
Thanks.
 
Bartender
Posts: 2087
44
Firefox Browser IntelliJ IDE Java Linux Spring
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This jar file does not contain source code.
 
Adam Szewczyk
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for reply
what about this

http://www.opensourcephysics.org/items/detail.cfm?ID=7209
 
Paweł Baczyński
Bartender
Posts: 2087
44
Firefox Browser IntelliJ IDE Java Linux Spring
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No source in this file. Jars are just regular zip files. You can unpack them easily and then check what's inside.
 
Author and ninkuma
Marshal
Posts: 66307
152
IntelliJ IDE Java jQuery Mac Mac OS X
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why would you expect to find source code in a jar file? A jar file is a collection of run-time components usually mostly consisting of class files and other resources needed at run time.

As pointed out, a jar file is just a fancy zip file, so anyone can put anything they want into it, but source code would be an odd thing to put in there. If someone wants to distribute their code, they'd do so with a zip file of source code (if they have their heads stuck in the past) or (a more modern approach) host it on a public repository such as github or bitbucket.
 
Adam Szewczyk
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for reply.
The reason I posted this question is because if you look at the first link I provided is that they offer a source code with xml documentation. I thought that it is just another format of code presentation. I was wrong.
Thanks for reply.....I suspected that jar does not have a source code in it but zip file with xml documentation it as the website claims. But I was wrong about that second assumption.
Good luck with Java coding.
Regards.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!