At first glance, I would say that the HelloWorldApp.java is an =
application
rather than a class. Someone correct me if I am wrong. I haven't touched
Java for 3 years, and I just started to get back into it.
A class would look something like below. The syntax is probably all =
wrong,
but I'm sure you get my drift.
Public class HelloWorldApp {
//constructor below
Public void HellowWorldApp {
// All other codes here.
}
// Other methods below
}
-----Original Message-----
From: tcl...@li...
[mailto:tcl...@li...] On Behalf Of Brian =
Theado
Sent: Thursday, June 16, 2005 7:50 PM
To: tcl...@li...
Subject: [tcljava-user] Problems instantiating my own class with =
java::new
Does anyone have a simple example using jacl of instantiating a class
you've written using the java::new command? Or do you know what I'm
doing wrong below?
I'm using precompiled jar files that I downloaded from swank
(http://www.onemoonscientific.com/swank/index.html).
Contents of c:\temp\HelloWorldApp.java:
/**=20
* The HelloWorldApp class implements an application that
* simply displays "Hello World!" to the standard output.
*/
class HelloWorldApp {
public static void main(String[] args) {
System.out.println("Hello World!"); //Display the string.
}
}
Transcript from the command-line:
C:\temp>javac HelloWorldApp.java
C:\temp>java HelloWorldApp
Hello World!
C:\temp>java -classpath c:\temp HelloWorldApp
Hello World!
C:\temp>java -classpath c:\temp;jacl.jar;tcljava.jar;swank.jar
tcl.lang.SwkShell
% java::new HelloWorldApp
Class "HelloWorldApp" is not accessible
% java::new BogusClass
unknown class "BogusClass"
% java::new java.lang.String hello
java0x2
% exit
I'm trying to figure out why I'm getting the "is not accessible" error
above. Anyone see what I'm doing wrong? If it was a classpath issue,
then I would expect to get the "unknown class" error.
Thanks,
Brian Theado
-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_idt77&alloc_id=16492&op=3Dick
_______________________________________________
tcljava-user mailing list
tcl...@li...
https://lists.sourceforge.net/lists/listinfo/tcljava-user
|