-2

I have a assignment to develop a Java Applet using Notepad++ only. Our lecturer has forbidden us from using eclipse, netbeans and so forth.

I can't seem to see any links on how to tackle this. Most applet programs rely on using netbeans or other sophisticated compilers.

Any help is appreciated

Sorry...we aren't allowed to use "javac or Java". Apparently the program should run without using them.

lecardo
  • 1,208
  • 4
  • 15
  • 37
  • 2
    *Most applet programs rely on using netbeans or other sophisticated compilers* The base compiler is [`javac`](http://docs.oracle.com/javase/7/docs/technotes/tools/solaris/javac.html). Probably part of your homework is to learn to use this program to compile your code. – Luiggi Mendoza Nov 19 '13 at 21:07
  • 1
    From your question edit: *we aren't allowed to use "javac or Java". Apparently the program should run without using them* or your professor is nuts and don't know about Java or you haven't took the right notes for your homework. – Luiggi Mendoza Nov 19 '13 at 21:19
  • This question appears to be off-topic because it is impossible. – Robin Green Nov 19 '13 at 21:25
  • Being able to answer a question by intuiting what the user is asking is an important skill. There is minimal understanding because the user is new to programming. Still the user clearly articulated where they are confused. – Nathaniel Johnson Nov 19 '13 at 21:51

2 Answers2

3

Netbeans (Eclipse, etc.) is not a Java compiler. The program javac for example is.

Your teacher expects you to write the source code in a simple text editor (Notepad++ etc.), that file can then be compiled using the command javac.

javac FirstApplet.java

This will then generate a *.class file, your compiled source code.

The next step would be to write the HTML code that embedds this class file.

The following guide might help you: http://www.cis.upenn.edu/~bcpierce/courses/629/papers/Java-tutorial/getStarted/applet/index.html

reto
  • 9,995
  • 5
  • 53
  • 52
  • You know this as well... This should be a comment. -1 – Martijn Courteaux Nov 19 '13 at 21:08
  • Nor NetBeans or Eclipse are Java compilers, but they are IDEs to ease the development on Java and other languages. But, they may use a different compiler than javac to compile the code, AFAIK Eclipse uses [EJC](http://blog.deepakazad.com/2010/05/ecj-eclipse-java-compiler.html), and also [Netbeans also uses a different compiler](http://wiki.netbeans.org/FaqCompileOnSave) (it only says is an internal compiler). – Luiggi Mendoza Nov 19 '13 at 21:15
  • 1
    Granted, I added some things after the first revision, but this looks like a reasonable answer to me. – reto Nov 19 '13 at 21:30
1

I believe you misunderstood your teacher. There is no java without javac, unless you use some kind of special compiler like gcj, which I suspect is not what your teacher wants. I believe that your teacher actually wants you to use the command line tools and a simple editor. The teacher is saying: I do not want you to use templates or auto suggestion to complete the assignment and you need to open a terminal and type in the commands to compile (javac) and run (java) your program yourself.

Cay Horstman, co-author of Core JAva has a good tutorial on this in windows. http://www.horstmann.com/bigj/help/compiler/tutorial.html

The process works like this:

Java comes with a bunch of different tools and, depending on your Operating System, those tools will be installed in a directory that you can then run them from. For the purposes of this exercise, you can get by with three programs, notepad.exe, javac.exe, and java.exe. When these are installed via the Oracle installer, you might need to make sure that all of them accessible via the Windows path.

Step 1:

Find where you want to store your program. When I work in Windows, I use a directory called c:\dev because it is easier to type.

Step 2:

Create the file and save it to c:\dev Name it MyClass1.java

Step 3: Compile the file into Java Bytecode javac MyClass1

This will create a file called MyClass1.class which, depending on the actual java code inside the file, can be run with the java command (Step 4) or embedded in a web page (Step 5)

Step 4: Run the program

java MyClass1

Step 5: If the class extend JApplet then you must embed a reference to the class file in a web page and then load the page in a browser. The official tutorial on this is here:http://docs.oracle.com/javase/tutorial/uiswing/components/applet.html

Nathaniel Johnson
  • 4,731
  • 1
  • 42
  • 69