here's the steps i took in creating the self signed jar file.
firstly i created the certificate
c:\j2sdk1.4.2_06\bin\keytool -genkey -keyalg rsa -alias dazkey
c:\j2sdk1.4.2_06\bin\keytool -export -alias dazkey -file dazsuncert.crt
then i created the jar
c:\j2sdk1.4.2_06\bin\jar cvf c:\applets\Helloserver.jar
c:\applets\Helloserver.class
then signed and verified it
c:\j2sdk1.4.2_06\bin\jarsigner c:\applets\Helloserver.jar dazkey
c:\j2sdk1.4.2_06\bin\jarsigner -verify -verbose -certs
c:\applets\Helloserver.jar
to test it i put the jar file and html file on there own on my website
Helloserver.htm
Helloserver.jar
the content of the html file are as follows
<HTML>
<HEAD>
</HEAD>
<BODY>
<CENTER>
<APPLET
codebase = "."
archive = "Helloserver.jar"
code = "Helloserver.class"
width = "500"
height = "300"
>
</APPLET>
</CENTER>
</BODY>
</HTML>
The java consol stated the following
Java Plug-in 1.5.0_04
Using JRE version 1.5.0_04 Java HotSpot(TM) Client VM
User home directory = C:\WINDOWS
load: class Helloserver.class not found.
java.lang.ClassNotFoundException: Helloserver.class
at sun.applet.AppletClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.applet.AppletClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.applet.AppletClassLoader.loadCode(Unknown Source)
at sun.applet.AppletPanel.createApplet(Unknown Source)
at sun.plugin.AppletViewer.createApplet(Unknown Source)
at sun.applet.AppletPanel.runLoader(Unknown Source)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.io.IOException: open HTTP connection failed.
at sun.applet.AppletClassLoader.getBytes(Unknown Source)
at sun.applet.AppletClassLoader.access$100(Unknown Source)
at sun.applet.AppletClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
... 10 more
Exception in thread "Thread-4" java.lang.NullPointerException
at sun.plugin.util.GrayBoxPainter.showLoadingError(Unknown Source)
at sun.plugin.AppletViewer.showAppletException(Unknown Source)
at sun.applet.AppletPanel.runLoader(Unknown Source)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
java.lang.NullPointerException
at sun.plugin.util.GrayBoxPainter.showLoadingError(Unknown Source)
at sun.plugin.AppletViewer.showAppletStatus(Unknown Source)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Exception in thread "thread applet-Helloserver.class"
java.lang.NullPointerException
at sun.plugin.util.GrayBoxPainter.showLoadingError(Unknown Source)
at sun.plugin.AppletViewer.showAppletException(Unknown Source)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
now when i put the class file instead of the jar and removed the jar file
and the archive tag from the html file the class loads ok but again i get
the security problems.
Help
> archive = "Helloserver.jar"
> code = "Helloserver.class"
You don't post a class without a package. That is only for
experimenting. I suspect signing presumes packages.
--
Canadian Mind Products, Roedy Green.
http://mindprod.com Again taking new Java programming contracts.
> codebase = "."
that does not do anything. Just leave it out.
> archive = "Helloserver.jar"
> code = "Helloserver.class"
An Applet should always have a package. Also be careful. Java and some
servers are case sensitive. To avoid getting bitten, I consistently
use a convention:
1. packages are always lower case.
2. jar names are always lower case.
3. classes always start with a capital letter.
e.g.
code="com.mindprod.wassup.Wassup.class"
archive="wassup.jar"
>load: class Helloserver.class not found.
look in your jar. Is the class in there with no package, spelled
EXACTLY like that including case. Use Winzip or the like to peek.
JarLook will produce a list of what is in a jar.
see http://mindprod.com/products1.html#JARLOOK
>now when i put the class file instead of the jar and removed the jar file
>and the archive tag from the html file the class loads ok but again i get
>the security problems.
Obviously. You can't sign a class file, only a jar.
Here's a tutorial on how to use packages in java:
http://jarticles.com/package/package_eng.html
- Oliver
How is the com.mindprod.wassup constructed. Is it something you made up on
bespoke or is there a reason the syntax is like that? Also when i put
package in my applet. e.g 'package helloserver;' it creates a subdirector
called helloserver and i suspect if i were to call my package
"com.g7wap.helloserver" it would create a directory tree starting with com
then one below would be g7wap and the one below would be helloserver. if
this is the case then how would i reflect this in the jar archive? would jar
create the directory structure automatically based on the "package" entry in
the applet?
>by package you mean like 'java.net' or 'java.io'?
>does my package name need to be in a similar format?
>how do i include it in my html applet tag?
See http://mindprod.com/jgloss/package.html
http://mindprod.com/jgloss/applet.html
also see http://mindprod.com/jgloss/gettingstarted.html
You need an intro textbook of some sort, even a very out of date one
to explain these basic.
>How is the com.mindprod.wassup constructed. Is it something you made up on
>bespoke or is there a reason the syntax is like that?
I own the domain mindprod.com. So I name all my packages
com.mindprod. That insures they will be globally unique.
wassup is the name of a package, a group of related classes.
Wassup in the name of my Applet and the main class, the one that is
used to get the whole ball rolling.
so archive="wassup.jar" ( to contain all the wassup class files)
code="com.mindprod.wassup.Wassup" to tell the browser the package
and class name of my main class.
If you want to examine the code and html, see
http://mindprod.com/applets/wassup.html
I have posted all kinds of applets you can play with and modify.
>called helloserver and i suspect if i were to call my package
>"com.g7wap.helloserver" it would create a directory tree starting with com
Your package name reflects your directory structure.
What I am about to say is not completely true, but true enough for
your level:
I create a directory structure like this:
C:\com\mindprod\wassup
Than I put my Wassup.java file there.
Then I compile to create Wassup.class in that same directory
then I jar to create wassup.jar
then I sign the jar (a step you can leave out for now).
then I post that on my website or run the jar locally.
I usually give my Applet a main method so I can run it as as
application to debug it without the fuss of a browser.
If you use an IDE it creates the package directories for you in
project directories. You organise your related packages into
projects.
> jar
>create the directory structure automatically based on the "package" entry in
>the applet?
not quite automatically, but the jar had bloody BETTER reflect the
package structure with the member name hierarchy. See
http://mindprod.com/jgloss/jar.html
http://mindprod.com/jgloss/jarexe.html
http://mindprod.com/jgloss/classpath
For all this compiling, jaring etc, sooner or later you will want to
use ant scripts. You are welcome to use any of mine posted at
http://mindprod.com/products.html
and strip out what you don't need.
path like a directory structure, got it :)
>
> also see http://mindprod.com/jgloss/gettingstarted.html
>
> You need an intro textbook of some sort, even a very out of date one
> to explain these basic.
I have a book on java 2 somewhere, probably in the attic. Bloody hell i hate
the dark. :)
Do you need to include the directory info in the jar?
>I have a book on java 2 somewhere, probably in the attic. Bloody hell i hate
>the dark. :)
You can get something on eBay or in one of those cheap computer
bookstores that specialise in slightly out of date books.
>Do you need to include the directory info in the jar?
You need at least a main class. Its java name is for example:
com.mindprod.wassup.Wassup.class
In the jar in will have the name:
com/mindprod/wassup/Wassup.class
You don't need an entry for each directory level, just the files.
Jar.exe handles that. You just tell it which classes and resources you
want in there.
When you sign it will add some additional files of the digests and
digital signatures.
Verify you got it right with Winzip or something similar.
Signing does not presume/need packages, but I agree with you.
(One should use them to keep things globally unique)
I suspect "jar" messes up a little when he doesn't use packages,
but gives a full ms-dos path to his .class file
<quote>
c:\j2sdk1.4.2_06\bin\jar cvf c:\applets\Helloserver.jar
c:\applets\Helloserver.class
c:\j2sdk1.4.2_06\bin\jarsigner c:\applets\Helloserver.jar dazkey
c:\j2sdk1.4.2_06\bin\jarsigner -verify -verbose -certs
c:\applets\Helloserver.jar
</quote>
I think the results will be different if he change to "c:\applets"
and try to jar, and sign it from there, the results might be different:
c:\applets> jar cvf helloserver.jar Helloserver.class
c:\applets> jarsigner helloserver.jar dazkey
c:\applets> jarsigner -verify -verbose -certs helloserver.jar
And Darren...
Can you give us the result the last command you run:
"jarsigner -verify -verbose -certs helloserver.jar"
--
Dag.
Hello Darren...
I promised in another thread to sign an applet, and send it to you
so you could test if it worked at all...
I sendt a test-setup with source & a signed applet to your
"devslashnul.net" address, but i suspect that isn't a valid one.
If you mail me your address, I'll send it to you.
--
Dag.
141 Wed Sep 21 11:46:20 BST 2005 META-INF/MANIFEST.MF
194 Wed Sep 21 11:46:22 BST 2005 META-INF/DAZKEY.SF
932 Wed Sep 21 11:46:22 BST 2005 META-INF/DAZKEY.RSA
0 Wed Sep 21 11:38:40 BST 2005 META-INF/
smk 2224 Wed Sep 21 01:30:54 BST 2005 Helloserver.class
X.509, CN=myname, OU=Unknown, O=g7wap, L=myhome, ST=mylocal, C=uk (
dazkey)
s = signature was verified
m = entry is listed in manifest
k = at least one certificate was found in keystore
i = at least one certificate was found in identity scope
jar verified.
>
> --
> Dag.
>
>
Looks perfectly Ok!
Can you send me your mail-address?
--
Dag.
>hat's interesting. I tried to open the jar i created and winzip replied
>"failed to load main-class manifest attribute" and when i compress the class
>file with jar i get "manifest added"
This makes no sense. Winzip knows nothing about manifests.
Start winzip.
Do a file open of xxx.jar
View the contents.
You don't use Winzip to manipulate jars, just peek inside them.
Jar.exe requires you to write a tiny skeleton manifest file, that
jar.exe includes and augments. This is all described under
http://mindprod.com/jgloss/jarexe.html
and
http://mindprod.com/jgloss/jar.html
When you look in the jar you should see at least two members,
your main class and the manifest file.
> 141 Wed Sep 21 11:46:20 BST 2005 META-INF/MANIFEST.MF
> 194 Wed Sep 21 11:46:22 BST 2005 META-INF/DAZKEY.SF
> 932 Wed Sep 21 11:46:22 BST 2005 META-INF/DAZKEY.RSA
> 0 Wed Sep 21 11:38:40 BST 2005 META-INF/
>smk 2224 Wed Sep 21 01:30:54 BST 2005 Helloserver.class
this is looking good, with one exception. Your main class still is not
in a package.
Does it have no dependent classes, not even those $ ones?
>I promised in another thread to sign an applet, and send it to you
>so you could test if it worked at all...
you can download the source and jar for a signed applet at
http://mindprod.com/products1.html#WASSUP
It also has an ant script for building it.
Sorry for the confusion, Rondey...
I promised Darren to write and sign the applet he needs
in another thread.
Just so he could verify that a signed applet would solve his
problem...
It was not meant as a response to your post...
--
Dag.
Yep that's what i did and i got the error message
>
> View the contents.
That was my intention
>
> You don't use Winzip to manipulate jars, just peek inside them.
I know, but it knows how to handle jar files apparently.
>
> Jar.exe requires you to write a tiny skeleton manifest file, that
> jar.exe includes and augments. This is all described under
> http://mindprod.com/jgloss/jarexe.html
> and
> http://mindprod.com/jgloss/jar.html
>
> When you look in the jar you should see at least two members,
> your main class and the manifest file.
I tried viewing with jar itself.
Jar -t -f Helloserver.jar
and it sat there waiting for me as if it was trying to get standard input. I
got the same without the -f flag so i assumned the -f flag would cover it
but i guess not.
If yours is genuine I can. :)
>
> --
> Dag.
>
>
H:\public_html>c:\j2sdk1.4.2_06\bin\jar tf helloserver.jar
META-INF/
META-INF/MANIFEST.MF
Helloserver.class
Shouldn't the Helloserver.class be in a directory namely
uk/me/g7wap/helloserver or is jar taking that as red for the codebase?
>
> You don't need an entry for each directory level, just the files.
> Jar.exe handles that. You just tell it which classes and resources you
> want in there.
>
> When you sign it will add some additional files of the digests and
> digital signatures.
>
>
> Verify you got it right with Winzip or something similar.
Winzip won't open it
Now what was the applet tag for adding the package data?
ok now i'm getting this from the java console
Why is it giving me a wrong name? the name of the package mathed the one
specified below (replacing slashes with dots of course)
java.lang.NoClassDefFoundError: Helloserver (wrong name:
uk/me/g7wap/helloserver/Helloserver)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$100(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at sun.applet.AppletClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.applet.AppletClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.applet.AppletClassLoader.loadCode(Unknown Source)
at sun.applet.AppletPanel.createApplet(Unknown Source)
at sun.plugin.AppletViewer.createApplet(Unknown Source)
at sun.applet.AppletPanel.runLoader(Unknown Source)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Exception in thread "Thread-5" java.lang.NullPointerException
at sun.plugin.util.GrayBoxPainter.showLoadingError(Unknown Source)
at sun.plugin.AppletViewer.showAppletException(Unknown Source)
at sun.applet.AppletPanel.runLoader(Unknown Source)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
java.lang.NullPointerException
at sun.plugin.util.GrayBoxPainter.showLoadingError(Unknown Source)
at sun.plugin.AppletViewer.showAppletStatus(Unknown Source)
at sun.applet.AppletPanel.createApplet(Unknown Source)
at sun.plugin.AppletViewer.createApplet(Unknown Source)
at sun.applet.AppletPanel.runLoader(Unknown Source)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Exception in thread "Thread-9" java.lang.NullPointerException
at sun.plugin.util.GrayBoxPainter.showLoadingError(Unknown Source)
at sun.plugin.AppletViewer.showAppletException(Unknown Source)
at sun.applet.AppletPanel.runLoader(Unknown Source)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
java.lang.NullPointerException
at sun.plugin.util.GrayBoxPainter.showLoadingError(Unknown Source)
at sun.plugin.AppletViewer.showAppletStatus(Unknown Source)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Exception in thread "thread applet-null" java.lang.NullPointerException
at sun.plugin.util.GrayBoxPainter.showLoadingError(Unknown Source)
at sun.plugin.AppletViewer.showAppletException(Unknown Source)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
>> This makes no sense. Winzip knows nothing about manifests.
>Apparently it does
I have been bugging Winzip for many years to add some jar support, but
every time they refuse. They won't even make jar a configurable
extension.
Are you using Beta 10.0?
I am trying to figure out how Winzip could possibly generate that
message. Main-Class in an entry INSIDE the manifest. Winzip is not
involved with content. It is just a container.
If you posted the weird jar somewhere, perhaps I could figure out what
you did.
>> You don't use Winzip to manipulate jars, just peek inside them.
>I know, but it knows how to handle jar files apparently.
don't use it to add elements. It uses compression techniques that
Java does not understand.
>Jar -t -f Helloserver.jar
for some reason the fool thing insists you collapse flags
jar -tf Helloserver.jar
--
dag.
>java.lang.NoClassDefFoundError: Helloserver (wrong name:
>uk/me/g7wap/helloserver/Helloserver)
If you posted your code and your bat files we would not be playing
doctor in the dark.
I trust you have code like this:
package uk.me.g7wap/helloserver;
public class Helloserver
in a file called C:\uk\me\g7wap\helloserver\Helloserver.java
I trust you created your jar with some code like this:
c:
cd \
rem your main.mft should look like this:
rem Main-Class uk/me/g7wap/helloserver.Helloserver
rem following should be on one line:
jar.exe -cvfm
uk\me\g7wap\helloserver.jar
uk\me\g7wap\helloserver\main.mft
uk\me\g7wap\helloserver\*.class
then you signed it with:
jarsigner.exe helloserver.jar mycert
>java.lang.NoClassDefFoundError: Helloserver
at this point you can also read the generic advice for this exception:
see http://mindprod.com/jgloss/caq.html
>Now what was the applet tag for adding the package data?
hint. Whatever you want to know about, look up that word in the java
glossary at http://mindprod.com/jgloss.html
In this case the entry is at http://mindprod.com/jgloss/applet.html
>
>Shouldn't the Helloserver.class be in a directory namely
>uk/me/g7wap/helloserver or is jar taking that as red for the codebase?
Please re-read the examples I gave you at:
http://mindprod.com/jgloss/javacexe.html
http://mindprod.com/jgloss/jarexe.html
http://mindprod.com/jgloss/jar.html
http://mindprod.com/jgloss/jarsigner.html
http://mindprod.com/jgloss/classpath.html
You have repeatedly refused to post code or bat files. I can't tell
what you are doing. You are demanding surgery by flashlight.
Your class should be in a package. That package name should be
reflected in its member name in the jar.
I think what you are doing is:
c:
cd \uk\me\g7wap\helloserver
jar.exe -cvfm helloserver.jar main.mft *.class
which is wrong. Jar.exe is incredibly stupid. You must have the
precise package info on the command line as I show you at
http://mindprod.com/jgloss/jarexe.html
Well i won't argue with you. You know far more about this sort of thing than
I do but perhaps winzip was on about the directory?
>
> Are you using Beta 10.0?
No. 9.
>
> I am trying to figure out how Winzip could possibly generate that
> message. Main-Class in an entry INSIDE the manifest. Winzip is not
> involved with content. It is just a container.
Hey I'm with you on that one but what can I say? That#s what it said
>
> If you posted the weird jar somewhere, perhaps I could figure out what
> you did.
Alt.binaries perhaps?
I did once and I got mocked for doing so but if you prefer here it is.
package uk.me.g7wap.helloserver;
import java.awt.*;
import java.applet.*;
import java.net.*;
import java.io.*;
import java.security.*;
import java.lang.*;
public class Helloserver extends Applet
{
private String hostname = "http://g7wap.dyndns.org/";
private String protocol = "http://";
private String port="80";
private String buf;
private URL location;
private Object content;
private String tmpStr = "GET / HTTP / 1.1\r\n\r\n";//Accept:
*/*\r\n\r\n";//Accept-Language: en-gb\r\n\r\nXXXXXXXXXXXXXXX:
XXXXXXXXXXXXX\r\n\r\nUser-Agent: HelloServer 1\r\n\r\n";
private byte[] getStr = tmpStr.getBytes();
public void init()
{
hello();
}
public void paint(Graphics g)
{
g.drawString(buf, 50, 60 );
}
/**
* Method hello
*
*
* @return
*
*/
protected boolean hello()
{
String str,server;
byte[] ba = new byte[1024];
int bytesRead;
Socket socket=new Socket();
buf="";
try
{
// O P E N
socket = new Socket();
socket.setSoTimeout(3000);
socket.connect(new InetSocketAddress("10.0.0.254", 80),3000 );
}
catch(AccessControlException u)
{
buf=u.getMessage();
}
catch(MalformedURLException u)
{
buf=u.getMessage();
}
catch (UnknownHostException u)
{
return false;
}
catch(SocketTimeoutException u)
{
return false;
}
catch(IOException u)
{
}
try
{
InputStream is = socket.getInputStream();
try
{
OutputStream os= socket.getOutputStream();
try
{
os.write(getStr,0,tmpStr.length());
}
catch(IOException u)
{
}
}
catch(IOException u)
{
}
// R E A D
// -1 means eof.
// You don't necessarily get all you ask for in one read.
// You get what's immediately available.
bytesRead = is.read( ba, 0 /* offset in ba */, ba.length /* bytes to
read */ );
if (bytesRead!=-1)
{
System.out.println(bytesRead);
buf=new String(ba);
System.out.println(buf);
is.close();
}
}
catch(IOException u)
{
}
// C L O S E
try
{
socket.close();
}
catch(IOException u)
{
}
return true;
}
}
>
> I trust you have code like this:
>
> package uk.me.g7wap/helloserver;
no
package uk.me.g7wap.helloserver;
> public class Helloserver
>
> in a file called C:\uk\me\g7wap\helloserver\Helloserver.java
no the java is located elsewhre but the class is produced in
C:\uk\me\g7wap\helloserver\
so C:\uk\me\g7wap\helloserver\Helloserver.class
>
> I trust you created your jar with some code like this:
>
> c:
> cd \
>
> rem your main.mft should look like this:
> rem Main-Class uk/me/g7wap/helloserver.Helloserver
> rem following should be on one line:
> jar.exe -cvfm
> uk\me\g7wap\helloserver.jar
> uk\me\g7wap\helloserver\main.mft
> uk\me\g7wap\helloserver\*.class
>
> then you signed it with:
>
> jarsigner.exe helloserver.jar mycert
no more like
C:\>cd C:\applets\uk\me\g7wap\helloserver
C:\applets\uk\me\g7wap\helloserver>
C:\applets\uk\me\g7wap\helloserver>c:\j2sdk1.4.2_06\bin\jar cvf
Helloserver.jar Helloserver.class
added manifest
adding: Helloserver.class(in = 2224) (out= 1332)(deflated 40%)
C:\applets\uk\me\g7wap\helloserver>c:\j2sdk1.4.2_06\bin\jarsigner
Helloserver.jar dazkey
Enter Passphrase for keystore:
C:\applets\uk\me\g7wap\helloserver>c:\j2sdk1.4.2_06\bin\jarsigner -verify -v
erbose -certs Helloserver.jar
141 Thu Sep 22 13:16:28 BST 2005 META-INF/MANIFEST.MF
194 Thu Sep 22 13:16:30 BST 2005 META-INF/DAZKEY.SF
932 Thu Sep 22 13:16:30 BST 2005 META-INF/DAZKEY.RSA
0 Thu Sep 22 13:14:26 BST 2005 META-INF/
smk 2224 Thu Sep 22 01:28:36 BST 2005 Helloserver.class
X.509, CN=darren simpson, OU=Unknown, O=g7wap, L=mylocation,
ST=myprovince, C=uk (
dazkey)
s = signature was verified
m = entry is listed in manifest
k = at least one certificate was found in keystore
i = at least one certificate was found in identity scope
jar verified.
Is your way better. Is your manifest file an executable script?
Ahh... There we have your class not found error!
When you "jar" a class in a package, you must position yourself
one step above the package (In the case above, in C:\), and execute
jar from there. Giving it the full path down to your class-files.
c:\> jar -cfv helloserver.jar uk\me\g7wap\helloserver\*.class
Now, helloserver.jar will be present in the C:\ root, and it will
contain the full package.
--
DFag.
Ah hence the c flag. It would be easier if jar read an enironment vairiable,
documentroot or codebase or something.
>
> Now, helloserver.jar will be present in the C:\ root, and it will
> contain the full package.
I'll try it and let you know
well the jar file looks more encouraging
C:\applets>c:\j2sdk1.4.2_06\bin\jarsigner -verify -verbose -certs
uk\me\g7wap\helloserver\Helloserver.jar
165 Thu Sep 22 17:22:48 BST 2005 META-INF/MANIFEST.MF
218 Thu Sep 22 17:22:48 BST 2005 META-INF/DAZKEY.SF
932 Thu Sep 22 17:22:48 BST 2005 META-INF/DAZKEY.RSA
0 Thu Sep 22 17:21:58 BST 2005 META-INF/
smk 2224 Thu Sep 22 01:28:36 BST 2005
uk/me/g7wap/helloserver/Helloserver.class
It's strange. I thought the package would have forced the directory
structure but then again jar is just an archiver
Now the clas not found is gone. I get
java.lang.NullPointerException
at sun.plugin.util.GrayBoxPainter.showLoadingError(Unknown Source)
at sun.plugin.AppletViewer.showAppletStatus(Unknown Source)
at sun.applet.AppletPanel.createApplet(Unknown Source)
at sun.plugin.AppletViewer.createApplet(Unknown Source)
at sun.applet.AppletPanel.runLoader(Unknown Source)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Exception in thread "Thread-5" java.lang.NullPointerException
at sun.plugin.util.GrayBoxPainter.showLoadingError(Unknown Source)
at sun.plugin.AppletViewer.showAppletException(Unknown Source)
at sun.applet.AppletPanel.runLoader(Unknown Source)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
java.lang.NullPointerException
at sun.plugin.util.GrayBoxPainter.showLoadingError(Unknown Source)
at sun.plugin.AppletViewer.showAppletStatus(Unknown Source)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Exception in thread "thread applet-null" java.lang.NullPointerException
at sun.plugin.util.GrayBoxPainter.showLoadingError(Unknown Source)
at sun.plugin.AppletViewer.showAppletException(Unknown Source)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
>
> --
> DFag.
>
>
>
> --
> dag.
>
>
It's an excellent site and though i have added to my favourites the next
time i do a rebuild because I'm senile i'll completely forget to back up my
favourites and bookmarks so with your permission i'll add it to my web site.
Not true. I have posted my code twice though my code has changed sonce the
first time and the socond time was in another part of this thread today as
you've probably already read :)
>
> Your class should be in a package. That package name should be
> reflected in its member name in the jar.
>
> I think what you are doing is:
>
> c:
> cd \uk\me\g7wap\helloserver
> jar.exe -cvfm helloserver.jar main.mft *.class
>
> which is wrong. Jar.exe is incredibly stupid. You must have the
> precise package info on the command line as I show you at
> http://mindprod.com/jgloss/jarexe.html
I've got you page open as i'm replying One would think that sun would add a
tag in jar to include path information relative to the class base directory
but then again who am i to argue with sun. :)
Indeed its a faux address, your mail will bounce. I've used a similar
protocol to another poster (Roedy Green I think) who took his domain name,
reversed it and made a package out of it.
>
> If you mail me your address, I'll send it to you.
ukWIBBLEmeWIBBLEg7wapWOBBLEdarren
reverse the whole thing it, replace WOBBLE with at and WIBBLE with dot and
you have it.
>
> --
> Dag.
>
>
There's some good stuff on there :)
I don't presume to know your e-mail address better than you, but
shouldn't you replace WOBBLE and WIBBLE *BEFORE* doing the reversing? And is
the reversing a character by character reversing, or a word by word one? =)
Or was giving an intentionally faulty algorithm part of the "trick" to evade
havester-bots? (if so, sorry for spoiling it)
Woe betide the day when our e-mail obfuscation techniques require
something more powerful than a Turing Machine to solve.
(E.g. Here's a set of 160 programs written in java. If the nth program
eventually terminates, then the nth bit in the ASCII representation of my
e-mail is a 1, otherwise it is a 0).
- Oliver
Now that's just nit picking. ;)
BTW how do you reverse a . and a @ but he who was to decypher it managed ok.
The reverse of the string "." is ".", in my opinion (and similarly for
"@"). If I were to follow your instructions literally, I'd start with the
string "ukWIBBLEmeWIBBLEg7wapWOBBLEdarren", reverse it to get
"nerradELBBOWpaw7gELBBIWemELBBIWku", replace "WOBBLE" with at (no changes
since WOBBLE never occurs in the new string), replace WIBBLE with dot (no
change because WIBBLE never occurs either) and end up with
"nerradELBBOWpaw7gELBBIWemELBBIWku"
- Oliver
Fortunately you would be too clever to do something silly like that but
thanks for the laughs though. I creased myself.
>
> - Oliver
>
>
>> If you posted the weird jar somewhere, perhaps I could figure out what
>> you did.
>
>Alt.binaries perhaps?
you could post it on a website or email it to me.
my email address is shown as a graphic at
http://mindprod.com/feedback/feedback.html
>> >Jar -t -f Helloserver.jar
>hey no i got it with 'jar tf Helloserver.jar'
the first is wrong, the second is ok, the - is optional, combining the
flags is not.
>I did once and I got mocked for doing so but if you prefer here it is.
There are people here for the sole purpose of ragging newbies.
All you can do is put them in your killfile. The correct thing to do
is post code, preferably a SSCCE. See
http://mindprod.com/jgloss/snippet.html
Here is your problem, as I predicted two posts back. You are in the
wrong directory to create your jar. You must be in the directory BELOW
your master package. e.g. C:\applets.
Please read the http://mindprod.com/jarexe.html entry again, and also
the sample bat stuff I posted.
There is further confusion if the class files live in
C:\applets\uk\me\g7wap\helloserver
or
C:\uk\me\g7wap\helloserver
I am assuming the first.
Start with
cd C:\applets
THEN build your jar. The command line will have the full package name
spelled out over and over.
You can use set package=uk\me\g7wap\helloserver
and %package% to abbreviate.
>no more like
>C:\>cd C:\applets\uk\me\g7wap\helloserver
>
>C:\applets\uk\me\g7wap\helloserver>
>
>C:\applets\uk\me\g7wap\helloserver>c:\j2sdk1.4.2_06\bin\jar cvf
>Helloserver.jar Helloserver.class
>added manifest
>adding: Helloserver.class(in = 2224) (out= 1332)(deflated 40%)
>C:\applets\uk\me\g7wap\helloserver>c:\j2sdk1.4.2_06\bin\jarsigner
>Helloserver.jar dazkey
>Enter Passphrase for keystore:
>
>C:\applets\uk\me\g7wap\helloserver>c:\j2sdk1.4.2_06\bin\jarsigner -verify -v
>erbose -certs Helloserver.jar
>Ah hence the c flag. It would be easier if jar read an enironment vairiable,
>documentroot or codebase or something.
As I warn you in http://mindprod.com/jgloss/jarexe.html jar.exe is
braindamaged with no common sense at all. It will happily create jars
with package names and member names out of sync with not so much as a
warning message.
>It's an excellent site and though i have added to my favourites the next
>time i do a rebuild because I'm senile i'll completely forget to back up my
>favourites and bookmarks so with your permission i'll add it to my web site.
You don't need my permission.
>Indeed its a faux address, your mail will bounce. I've used a similar
>protocol to another poster (Roedy Green I think) who took his domain name,
>reversed it and made a package out of it.
Note how sun packages for sun use are com.sun. *. IBM packages are
com.ibm. * mine are com.mindprod.*
It is the standard way to make up package names. I did not invent it.
Maybe not but i always seek permission from the owner of a website bedore i
put a link to it on mine. Not a legal requirement but it's the way i do
things.
Whatever. it works for me. :)
No need i got the jar thing down
The problem was something to do with the sourcecode. So i ripped it to
peices and got it working with a little help. :)