File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes can you create normal programs/exe's in Java? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "can you create normal programs/exe Watch "can you create normal programs/exe New topic
Author

can you create normal programs/exe's in Java?

Dave Fletcher
Greenhorn

Joined: Mar 06, 2010
Posts: 5
Hey I've been googling for this but didnt get a straight answer. I thought I read it somewhere but I'm not sure.

So, I am just wondering if Java can be used to create "normal", installable applications with .exe files and stuff.... You see, I am taking a Java class at college but all we do is make applets for web pages which doesn't even seem like a worth while thing to learn since I literally NEVER come across them on the internet... probably because people need to have the JRE installed before they can use the applet, and if they dont, they wont bother wasting their time.

Anyway, I used to want to learn C# to build some applications I had ideas for... but I read that Java is more safe and powerful, plus I am already learning it.. so would I still be able to do the same things in Java?

I'm also kind of confused where to start.. I installed NetBeans but have had some trouble actually using it... so I am sticking with Notepad++ which is what I use for my applets for my class, and then compile them with javac.exe

Thanks for your help. Also please maybe suggest a good book or links for me to check out... I am more interested in program/applications than just web applets.
fred rosenberger
lowercase baba
Bartender

Joined: Oct 02, 2003
Posts: 11229
    
  16

yes, you can write programs in java. You won't (well, you normally don't) end up with an .exe, but .class files. once you have those, you can drop them on any machine that has a JVM, and run them.

Check out our bunkhouse page for links to books. a popular one for beginners is "Head First Java", by Bates and Sierra.


There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

Dave Fletcher wrote:So, I am just wondering if Java can be used to create "normal", installable applications with .exe files and stuff.... You see, I am taking a Java class at college but all we do is make applets for web pages which doesn't even seem like a worth while thing to learn since I literally NEVER come across them on the internet... probably because people need to have the JRE installed before they can use the applet, and if they dont, they wont bother wasting their time.

You're right about applets, they are kind of a niche market in Java. If your class is focusing on applets then it's probably an out-of-date program; check the copyright date in your text to see how old it is. A lot of commercial Java programming is aimed at web applications -- those are the web sites that let you rent cars and book airline tickets and so on -- rather than at consumer applications.
Anyway, I used to want to learn C# to build some applications I had ideas for... but I read that Java is more safe and powerful, plus I am already learning it.. so would I still be able to do the same things in Java?


Yes, C# and Java are pretty much equivalent in power. And don't forget, if you want to distribute a C# application then your clients would have to have the .Net runtime installed before they could use it. Of course the installer would take care of this, but likewise Java installers take care of getting a JRE installed.
Greg Charles
Sheriff

Joined: Oct 01, 2001
Posts: 2848
    
  11

Java can definitely be used to write all kinds of applications, not just applets. (I dispute that you never come across applets on the Internet, but they are definitely less popular than we used to think they would be.) As Fred pointed out, Java programs compile into .class files, which contain Java byte code. These classes can then be run on any computer that has a compatible Java Virtual Machine (JVM). You can also group .class files into a .jar archive and treat that as your program.

It's worth noting that Dot Net is not any different in this respect. Although Dot Net applications compile into .exe files, that's just a name. In fact they contain Dot Net byte code, and so are fundamentally different from Windows native executables. You need to have the Dot Net framework installed on your Windows computer to make them work, just like you need a JVM to make Java applications work. There is also an open-source implementation of Dot Net called Mono, which means Dot Net executables are portable to other operating systems (at least in theory).
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: can you create normal programs/exe's in Java?