1833415 Members
3290 Online
110052 Solutions
New Discussion

Java swing on HPUX

 
Jeff Picton
Regular Advisor

Java swing on HPUX

Hello everybody

Can anyone tell me the HPUX classpath to compile a java program ?

for example :-

java -classpath.:/home/me/lnfdir/newlnf.jar HelloWorldSwing


7 REPLIES 7
Mike Stroyan
Honored Contributor

Re: Java swing on HPUX

You don't need to add anything to the default classpath to compile and run java swing.

You can download the SDK from http://www.hp.com/go/java, if you don't already have it. Then you just need the java bin directory in your path.

% PATH=$PATH:/opt/java1.4/bin
% javac HelloWorldSwing.java
% java HelloWorldSwing
Jeff Picton
Regular Advisor

Re: Java swing on HPUX

Hello

When I do this I get the following :-

$ PATH=$PATH:/opt/java1.3/bin
$ javac HelloWorldSwing.java
$ java HelloWorldSwing
Exception in thread "main" java.lang.NoSuchMethodError: main

Is this a problem with java1.3 ?

Thanks
Pieter_5
Advisor

Re: Java swing on HPUX

Hi, you need to add a main function to to program

public static void main(String[] args){
}

If you make a typo you will get same message.
Pieter_5
Advisor

Re: Java swing on HPUX

Please post you code to the forum
Jeff Picton
Regular Advisor

Re: Java swing on HPUX

Hi

I have seen many java programs without the main function and when I put this in I get the following :-

HelloWorldSwing.java:3: 'class' or 'interface' expected
public static void main(String[] args) {
^
1 error
Jeff Picton
Regular Advisor

Re: Java swing on HPUX

here is the code :-

import javax.swing.*;

public class HelloWorldSwing {
/**
* Create the GUI and show it. For thread safety,
* this method should be invoked from the
* event-dispatching thread.
*/
private static void createAndShowGUI() {
//Make sure we have nice window decorations.
// JFrame.setDefaultLookAndFeelDecorated(true);

//Create and set up the window.
javax.swing.SwingUtilities.invokeLater(new Runnable() {
public void run() {
createAndShowGUI();
}
});
}
}

~
"HelloWorldSwing.java" 24 lines, 621 characters
$ /opt/java1.3/bin/javac HelloWorldSwing.java
HelloWorldSwing.java:3: 'class' or 'interface' expected
public static void main(String[] args) {
^
1 error
Jeff Picton
Regular Advisor

Re: Java swing on HPUX

Hi

I have managed to now compile this but have an invalid DISPLAY variable to run the program.

Can anyone explain how to define the DISPLAY variable ?

Jeff