First steps developing in java applet. Directions
I have to develop a small applet using, of course, java. I am absolutely ignorant about java and the java world. I dont' have the time to learn java "the programming course way". I just need to hack together this thing and then I won't code in java anymore (I assume).
My question is relative to the following subquestions:
- is it feasible to code in java without eclipse, maven, etc ? I am pretty sure it is possible, technically, but is it really convenient/practically possible ?
- how is the typical build/shipping process for java applets, in particular considering the presence of dependencies ? At the moment I am doing "screaming for vendetta" approach: download the dependencies jars, unpacking them, compiling my own .java file with the applet, repacking everything as .jar, copying it onto the web. I am pretty sure this is not the way to go, but it worked... at least for now. Clearly, I cannot continue this way.
- I know Eclipse to be a behemot. how is the chance that I can produce something that works as in开发者_如何学运维 my current caveman approach within a couple of days ?
- anything else that you deem important
Thanks.
Is it feasible to code in java without eclipse, maven, etc ? I am pretty sure it is possible, technically, but is it really convenient/practically possible ?
Absolutely, you can write code in any text editor, compile with the javac
command, and execute with the java
command. It's not quite convenient, and Eclipse continuously loops a the build cycle for you.
I know Eclipse to be a behemot. how is the chance that I can produce something that works as in my current caveman approach within a couple of days ?
It's possible you'll be fine, but a little time with a real IDE will start increasing your productivity almost exponentially. To start, you'd be gaining intelligent code navigation, syntax validation, real-time debugging, refactoring support, and of course code completion.
Regarding your first point... yes, it is feasible to code outside an IDE in Java. a copy of your favorite text editor, the javadoc html pages and Ant will do just fine.
That said, you will be more productive in an IDE with Java.
"Back in the day", Eclipse and Netbeans were buggy and no other IDEs were free. So, plenty of people wrote lots of Java code (including me, and including my first applet) without the use of an IDE. You just switch back and forth between your command prompt where you would run javac
and your editor-of-choice where you would make changes.
Likewise, build management tools like Ant and Maven are nice for large projects with nontrivial dependencies, but you certainly don't need them to write "Hello, world!" or even a "Hello, world!" applet.
That being said, I don't see any reason not to use an IDE today. They provide plenty of nice features that others here have already mentioned, which can save you from thousands of unnecessary keystrokes and dozens of careless bugs.
Developing without Eclipse or any other IDE (maven is a different kind of beast) is entirely feasible, but not recommended if you are ignorant about the Java world and want to finish everything within a couple of days. So, I suggest that you go with Eclipse. Download the basic Java edition, which is suitable for applet development. Among other things it will allow you to run your applet in an applet viewer (without having to start a browser). This is very convenient for debugging.
About the dependencies, you could create a "fat jar", with everything in it. A plug-in can help you with this. The other solution will be to place the dependencies in a "lib" folder. Then, in your applet jar, you need to edit the manifest file to correctly set the classpath. This is usually done with an Ant target.
精彩评论