Amey Rane

Greenhorn
+ Follow
since Mar 21, 2007
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Amey Rane

I am passing two string arguments to the applet SurfCore.class through a cgi script. Please check wheter this is the right way to do it. All HTML code is in the proper tag . I could not keep it this way as its not allowed on the forum due to a security issue
--------------------------------------------------------------------------
print <<ENDF6;

applet code="SurfCore.class" width=900 height=900
param name=bgImage value="IMAGES/PurdueDataNetwork1.6_core.jpg"
param name=bgImage2 value="IMAGES/Router.jpg"
param name=bgImage3 value="IMAGES/CRouter.jpg"
param name=vlan_num value="
param name=vlan_num2 value="
ENDF6
print "$arv2";
print "$arv2_b";

print <<END9;
">/applet
/body
/html
END9
---------------------------------------------------------------------------
I am getting an error which looks like this

java.lang.NullPointerException
at SurfCore.init(SurfCore.java:106)
at sun.applet.AppletPanel.run(AppletPanel.java:380)
at java.lang.Thread.run(Thread.java:595)
---------------------------------------------------------------------------
Finally this is the Java File. The error is originating at line 106 which I have commented in the code as //LINE 106: Error
It just shows that second argument is not getting passed properly...

import java.awt.*;
import java.applet.*;
import java.awt.event.*;
public class SurfCore extends Applet {

Image purdue;
Image router1;
Image router2;
Font bigFont;

String foo;
String foo2;


int size; // counting the no. of vlan#
int size2; // counting the no. of vlan#
int bsize;
int bsize2;

int i = 0; // for iteration
int p = 0;
int w = 0;
int n = 0;
int s = 0;
int m = 0;
int m2= 0;
int k = 0;
int l = 0;
int j = 0;
int h = 0;
int v = 0;
int q = 0;



String[] test2=new String[4];
String[] test3=new String[4];
String[] test_des=new String[4]; // split for designated router
String[] test_des2=new String[4]; // split for designated router
String[] test_des3=new String[4]; // split for designated router
String[] test_des4=new String[4]; // split for designated router
String[] test=new String[500];
String[] V_Array=new String[500];
String[] V_cord =new String[5];


String[] Temp_2 =new String[3];
String[] Temp_3 =new String[3];


int[] test_des_cord=new int[3]; // integer forms
int[] test_des_cord2=new int[3]; // integer forms

String[] btest2=new String[4];
String[] btest3=new String[4];
String[] btest_des=new String[4]; // split for designated router
String[] btest_des2=new String[4]; // split for designated router
String[] btest_des3=new String[4]; // split for designated router
String[] btest_des4=new String[4]; // split for designated router
String[] btest=new String[500];
String[] bV_Array=new String[500];
String[] bV_cord =new String[5];


String[] bTemp_2 =new String[3];
String[] bTemp_3 =new String[3];

int match_flag=0;
int bmatch_flag=0;


int[] btest_des_cord=new int[3]; // integer forms
int[] btest_des_cord2=new int[3]; // integer forms


// The colors you will use
Color redColor;
Color greenColor;
Color blackColor;
Color orangeColor;
Color blueColor;


public void init()

{
bigFont = new Font("Arial",Font.BOLD,13);

// Standard colors can be named like this
redColor = Color.red;
blackColor = Color.black;
orangeColor = Color.orange;
blueColor = Color.blue;
greenColor = Color.green;
// The following 2 lines get the Purdue topology & router image

purdue = getImage(getCodeBase(), getParameter("bgImage"));
router1 = getImage(getCodeBase(), getParameter("bgImage2"));
router2 = getImage(getCodeBase(), getParameter("bgImage3"));


foo = getParameter("vlan_num");
foo2= getParameter("vlan_num2");

test = foo.split(";");
btest = foo2.split(";"); //LINE 106 Error

size = Integer.parseInt(test[(test.length - 4)]);
bsize = Integer.parseInt(btest[(btest.length - 4)]);

size2 = Integer.parseInt(test[(test.length - 5)]);
bsize2 = Integer.parseInt(btest[(btest.length - 5)]);

test_des = test[1].split(":");
test_des2 = test[(test.length - 3)].split(",");
test_des3 = test_des2[0].split("--");
test_des4 = test_des3[0].split("=");

btest_des = btest[1].split(":");
btest_des2 = btest[(btest.length - 3)].split(",");
btest_des3 = btest_des2[0].split("--");
btest_des4 = btest_des3[0].split("=");


Temp_2 = test[1].split(":");
Temp_3 = Temp_2[0].split("--");

bTemp_2 = btest[1].split(":");
bTemp_3 = bTemp_2[0].split("--");



//System.out.println("Value1 = " + test_des_cord[0] + " Value2 = " + test_des_cord[1]);
if (Temp_3[1].equals("lamb")) {
test_des_cord[0] = 212;
test_des_cord[1] = 30;
}else if (Temp_3[1].equals("lynn")) {
test_des_cord[0] = 430;
test_des_cord[1] = 199;
}else if (Temp_3[1].equals("tel")) {
test_des_cord[0] = 293;
test_des_cord[1] = 427;
}else if (Temp_3[1].equals("erht")) {
test_des_cord[0] = 48;
test_des_cord[1] = 210 ;
}

if (test_des4[0].equals("lamb-20-c6509-01")) {
match_flag = 1;
test_des_cord2[0] = 261;
test_des_cord2[1] = 132;
}else if (test_des4[0].equals("lynn-b168-c6509-01")) {
match_flag = 1;
test_des_cord2[0] = 383;
test_des_cord2[1] = 257;
}else if (test_des4[0].equals("tel-210-c6509-01")) {
match_flag = 1;
test_des_cord2[0] = 250;
test_des_cord2[1] = 375;
}else if (test_des4[0].equals("erht-5b-c6509-01")) {
match_flag = 1;
test_des_cord2[0] = 143;
test_des_cord2[1] = 266;
}
if (match_flag != 1) {
if (test_des4[1].equals("lamb")) {
test_des_cord2[0] = 307;
test_des_cord2[1] = 45;
} else if (test_des4[1].equals("lynn")) {
test_des_cord2[0] = 462;
test_des_cord2[1] = 184;
} else if (test_des4[1].equals("tel")) {
test_des_cord2[0] = 214;
test_des_cord2[1] = 476;
} else if (test_des4[1].equals("erht")) {
test_des_cord2[0] = 63;
test_des_cord2[1] = 181;
}
}

if (bTemp_3[1].equals("lamb")) {
btest_des_cord[0] = 212;
btest_des_cord[1] = 30;
}else if (bTemp_3[1].equals("lynn")) {
btest_des_cord[0] = 430;
btest_des_cord[1] = 199;
}else if (bTemp_3[1].equals("tel")) {
btest_des_cord[0] = 293;
btest_des_cord[1] = 427;
}else if (bTemp_3[1].equals("erht")) {
btest_des_cord[0] = 48;
btest_des_cord[1] = 210 ;
}

if (btest_des4[0].equals("lamb-20-c6509-01")) {
bmatch_flag = 1;
btest_des_cord2[0] = 261;
btest_des_cord2[1] = 132;
}else if (btest_des4[0].equals("lynn-b168-c6509-01")) {
bmatch_flag = 1;
btest_des_cord2[0] = 383;
btest_des_cord2[1] = 257;
}else if (btest_des4[0].equals("tel-210-c6509-01")) {
bmatch_flag = 1;
btest_des_cord2[0] = 250;
btest_des_cord2[1] = 375;
}else if (btest_des4[0].equals("erht-5b-c6509-01")) {
bmatch_flag = 1;
btest_des_cord2[0] = 143;
btest_des_cord2[1] = 266;
}
if (bmatch_flag != 1) {
if (btest_des4[1].equals("lamb")) {
btest_des_cord2[0] = 307;
btest_des_cord2[1] = 45;
} else if (btest_des4[1].equals("lynn")) {
btest_des_cord2[0] = 462;
btest_des_cord2[1] = 184;
} else if (btest_des4[1].equals("tel")) {
btest_des_cord2[0] = 214;
btest_des_cord2[1] = 476;
} else if (btest_des4[1].equals("erht")) {
btest_des_cord2[0] = 63;
btest_des_cord2[1] = 181;
}
}


//System.out.println("Value = " + size);
for (i = 0; i < size; i++) {
v = 0;
test2 = test[i+2+size2].split(":");
for (v = 0; v < 3; v++)
{
V_Array[m++] = test2[v];
}
}

for (i = 0; i < bsize; i++) {
v = 0;
btest2 = test[i+2+bsize2].split(":");
for (v = 0; v < 3; v++)
{
bV_Array[m2++] = btest2[v];
}
}

}
//System.out.println("M value = " + m);

// end init()

public void paint(Graphics g) {
//System.out.println(" MATH = " + test[(test.length - 1)]);
g.setFont(bigFont);
g.drawImage(purdue,0,0,this);
g.setColor(blackColor.brighter());
g.drawLine(585,5,585,145);
g.drawLine(586,6,586,146);
g.drawLine(585,5,875,5);
g.drawLine(585,6,875,6);
g.drawLine(585,145,875,145);
g.drawLine(585,146,875,146);
g.drawLine(875,5,875,145);
g.drawLine(876,6,876,146);
g.setColor(orangeColor.darker());
g.drawString("LEGEND",706,25);
g.setColor(blackColor.brighter());
g.drawImage(router1,593,38,null);
g.drawString("CURRENT FIRST-HOP ROUTER",665,70);
g.drawImage(router2,600,90,null);
g.drawString("IDEAL FIRST-HOP ROUTER",665,116);
if (test[(test.length - 1)].equals("YES_MATCH")) {
if (test_des_cord[0] != 0) {
g.drawImage(router1,test_des_cord[0],test_des_cord[1],null);
}
for (q = 1; q < m; q = q + 3) {
V_cord = V_Array[q+1].split(",");
g.drawString(V_Array[q], Integer.parseInt(V_cord[0])+55, Integer.parseInt(V_cord[1])+70);
}
} else {
if (test_des_cord[0] != 0) {
g.drawImage(router1,test_des_cord[0],test_des_cord[1],null);
}
for (q = 1; q < m; q = q + 3) {
V_cord = V_Array[q+1].split(",");
g.drawString(V_Array[q], Integer.parseInt(V_cord[0])+55, Integer.parseInt(V_cord[1])+70);
}
if (test_des_cord2[0] != 0) {
g.drawImage(router2,test_des_cord2[0],test_des_cord2[1],null);
}
}

if (btest[(btest.length - 1)].equals("YES_MATCH")) {
if (btest_des_cord[0] != 0) {
g.drawImage(router1,btest_des_cord[0],btest_des_cord[1],null);
}
for (q = 1; q < m2; q = q + 3) {
bV_cord = bV_Array[q+1].split(",");
g.drawString(bV_Array[q], Integer.parseInt(bV_cord[0])+55, Integer.parseInt(bV_cord[1])+70);
}
} else {
if (btest_des_cord[0] != 0) {
g.drawImage(router1,btest_des_cord[0],btest_des_cord[1],null);
}
for (q = 1; q < m2; q = q + 3) {
bV_cord = bV_Array[q+1].split(",");
g.drawString(bV_Array[q], Integer.parseInt(bV_cord[0])+55, Integer.parseInt(bV_cord[1])+70);
}
if (btest_des_cord2[0] != 0) {
g.drawImage(router2,btest_des_cord2[0],btest_des_cord2[1],null);
}
}
}
} // end class PurdueTopology
15 years ago
This is how the HTML script is passing the two arguments which are being manipulated in the Java Applet



<param name=vlan_num value="
<param name=vlan_num2 value="
ENDF6
print "$arv2";
print "$arv2_b";
15 years ago
The cgi script calling the Java Applet is in dev/cgi-bin and the Java Applet is in dev/JAVA_FILES so the folder JAVA_FILES/SurfCore.class....Do you think it is a class file error and not a programming error.
15 years ago
What does incompatible magic value mean? and what does a ClassFormatError usually signify?
15 years ago
No, I am actually developing on the server itself and the server itself has all the java files. How do I check whether the files are working locally without uploading them to the web server?
15 years ago
Hi, I am interested in IBM exam 255 and 256. I would like to know whether there are any good certification books or guides which can help me in my preparation
15 years ago
I didnt get you? Are you asking me to check wether my HTML file is calling the updated version of SurfCore.class
15 years ago
36;tel--tel:462,845,533,845;sc--tel:76.9%:451,819,574,819;math--tel:12.8%:462,782,574,782;stew--tel:5.1%:460,828,482,828;enad--lamb:2.5%:334,176,410,176;yong--lynn:2.56%:694,311,750,311;lynn:2.56%:340,154;lamb:2.5%:198,32;tel:94.8%:195,352;5;3;tel-210-c6509-01=tel--195,352;tel-210-c6506-01=tel--462,845,533,845;NO_MATCH
For your reference this is how the parameter foo or foo2 will look
15 years ago
Thank you for your help.I tried installing a new java plug-in but now I am getting a run time error. Unfortunately its not showing which line has the error and since I am new to Applet development I am confused. Please look at this error and the applet code and help me out.
---------------------------------------------------------------------------
Java Plug-in 1.6.0_06
Using JRE version 1.6.0_06 Java HotSpot(TM) Client VM
User home directory = C:\Documents and Settings\arane


----------------------------------------------------
c: clear console window
f: finalize objects on finalization queue
g: garbage collect
h: display this help message
l: dump classloader list
m: print memory usage
o: trigger logging
p: reload proxy configuration
q: hide console
r: reload policy configuration
s: dump system and deployment properties
t: dump thread list
v: dump thread stack
x: clear classloader cache
0-5: set trace level to <n>
----------------------------------------------------

Value recvd = 36;tel--tel:462,845,533,845;sc--tel:76.9%:451,819,574,819;math--tel:12.8%:462,782,574,782;stew--tel:5.1%:460,828,482,828;enad--lamb:2.5%:334,176,410,176;yong--lynn:2.56%:694,311,750,311;lynn:2.56%:340,154;lamb:2.5%:198,32;tel:94.8%:195,352;5;3;tel-210-c6509-01=tel--195,352;tel-210-c6506-01=tel--462,845,533,845;NO_MATCH
Length: 15
Value = 3
Value1 = tel
VALUE = tel-210-c6509-01
VALUE = 250 375
Exception in thread "Thread-7" java.lang.NullPointerException
at sun.plugin.util.AnimationPanel.createTranslucentImage(Unknown Source)
at sun.plugin.util.AnimationPanel.createGradientShapeImage(Unknown Source)
at sun.plugin.util.AnimationPanel.initBackground(Unknown Source)
at sun.plugin.util.AnimationPanel.preloadResources(Unknown Source)
at sun.plugin.util.AnimationPanel.doPaint(Unknown Source)
at sun.plugin.util.AnimationPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
java.lang.ClassFormatError: Incompatible magic value 1011369281 in class file JAVA_FILES/SurfCore
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(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)


----------------------------------------------------------------------------

import java.awt.*;
import java.applet.*;
import java.awt.event.*;
public class SurfCore extends Applet {

Image purdue;
Image router1;
Image router2;
Font bigFont;

String foo;
String foo2;
String arg;

String[] arguments = new String[2];

int size; // counting the no. of vlan#
int size2; // counting the no. of vlan#
int bsize;
int bsize2;

int i = 0; // for iteration
int p = 0;
int w = 0;
int n = 0;
int s = 0;
int m = 0;
int m2= 0;
int k = 0;
int l = 0;
int j = 0;
int h = 0;
int v = 0;
int q = 0;



String[] test2=new String[4];
String[] test3=new String[4];
String[] test_des=new String[4]; // split for designated router
String[] test_des2=new String[4]; // split for designated router
String[] test_des3=new String[4]; // split for designated router
String[] test_des4=new String[4]; // split for designated router
String[] test=new String[500];
String[] V_Array=new String[500];
String[] V_cord =new String[5];


String[] Temp_2 =new String[3];
String[] Temp_3 =new String[3];


int[] test_des_cord=new int[3]; // integer forms
int[] test_des_cord2=new int[3]; // integer forms

String[] btest2=new String[4];
String[] btest3=new String[4];
String[] btest_des=new String[4]; // split for designated router
String[] btest_des2=new String[4]; // split for designated router
String[] btest_des3=new String[4]; // split for designated router
String[] btest_des4=new String[4]; // split for designated router
String[] btest=new String[500];
String[] bV_Array=new String[500];
String[] bV_cord =new String[5];


String[] bTemp_2 =new String[3];
String[] bTemp_3 =new String[3];

int match_flag=0;
int bmatch_flag=0;


int[] btest_des_cord=new int[3]; // integer forms
int[] btest_des_cord2=new int[3]; // integer forms


// The colors you will use
Color redColor;
Color greenColor;
Color blackColor;
Color orangeColor;
Color blueColor;


public void init()

{
bigFont = new Font("Arial",Font.BOLD,13);

// Standard colors can be named like this
redColor = Color.red;
blackColor = Color.black;
orangeColor = Color.orange;
blueColor = Color.blue;
greenColor = Color.green;
// The following 2 lines get the Purdue topology & router image

purdue = getImage(getCodeBase(), getParameter("bgImage"));
router1 = getImage(getCodeBase(), getParameter("bgImage2"));
router2 = getImage(getCodeBase(), getParameter("bgImage3"));

arg = getParameter("vlan_num");
arguments = arg.split(">");
foo = arguments[0];
foo2= arguments[1];

test = foo.split(";");
btest = foo2.split(";");

size = Integer.parseInt(test[(test.length - 4)]);
bsize = Integer.parseInt(btest[(btest.length - 4)]);

size2 = Integer.parseInt(test[(test.length - 5)]);
bsize2 = Integer.parseInt(btest[(btest.length - 5)]);

test_des = test[1].split(":");
test_des2 = test[(test.length - 3)].split(",");
test_des3 = test_des2[0].split("--");
test_des4 = test_des3[0].split("=");

btest_des = btest[1].split(":");
btest_des2 = btest[(btest.length - 3)].split(",");
btest_des3 = btest_des2[0].split("--");
btest_des4 = btest_des3[0].split("=");


Temp_2 = test[1].split(":");
Temp_3 = Temp_2[0].split("--");

bTemp_2 = btest[1].split(":");
bTemp_3 = bTemp_2[0].split("--");



//System.out.println("Value1 = " + test_des_cord[0] + " Value2 = " +
test_des_cord[1]);
if (Temp_3[1].equals("lamb")) {
test_des_cord[0] = 212;
test_des_cord[1] = 30;
}else if (Temp_3[1].equals("lynn")) {
test_des_cord[0] = 430;
test_des_cord[1] = 199;
}else if (Temp_3[1].equals("tel")) {
test_des_cord[0] = 293;
test_des_cord[1] = 427;
}else if (Temp_3[1].equals("erht")) {
test_des_cord[0] = 48;
test_des_cord[1] = 210 ;
}

if (test_des4[0].equals("lamb-20-c6509-01")) {
match_flag = 1;
test_des_cord2[0] = 261;
test_des_cord2[1] = 132;
}else if (test_des4[0].equals("lynn-b168-c6509-01")) {
match_flag = 1;
test_des_cord2[0] = 383;
test_des_cord2[1] = 257;
}else if (test_des4[0].equals("tel-210-c6509-01")) {
match_flag = 1;
test_des_cord2[0] = 250;
test_des_cord2[1] = 375;
}else if (test_des4[0].equals("erht-5b-c6509-01")) {
match_flag = 1;
test_des_cord2[0] = 143;
test_des_cord2[1] = 266;
}
if (match_flag != 1) {
if (test_des4[1].equals("lamb")) {
test_des_cord2[0] = 307;
test_des_cord2[1] = 45;
} else if (test_des4[1].equals("lynn")) {
test_des_cord2[0] = 462;
test_des_cord2[1] = 184;
} else if (test_des4[1].equals("tel")) {
test_des_cord2[0] = 214;
test_des_cord2[1] = 476;
} else if (test_des4[1].equals("erht")) {
test_des_cord2[0] = 63;
test_des_cord2[1] = 181;
}
}

if (bTemp_3[1].equals("lamb")) {
btest_des_cord[0] = 212;
btest_des_cord[1] = 30;
}else if (bTemp_3[1].equals("lynn")) {
btest_des_cord[0] = 430;
btest_des_cord[1] = 199;
}else if (bTemp_3[1].equals("tel")) {
btest_des_cord[0] = 293;
btest_des_cord[1] = 427;
}else if (bTemp_3[1].equals("erht")) {
btest_des_cord[0] = 48;
btest_des_cord[1] = 210 ;
}

if (btest_des4[0].equals("lamb-20-c6509-01")) {
bmatch_flag = 1;
btest_des_cord2[0] = 261;
btest_des_cord2[1] = 132;
}else if (btest_des4[0].equals("lynn-b168-c6509-01")) {
bmatch_flag = 1;
btest_des_cord2[0] = 383;
btest_des_cord2[1] = 257;
}else if (btest_des4[0].equals("tel-210-c6509-01")) {
bmatch_flag = 1;
btest_des_cord2[0] = 250;
btest_des_cord2[1] = 375;
}else if (btest_des4[0].equals("erht-5b-c6509-01")) {
bmatch_flag = 1;
btest_des_cord2[0] = 143;
btest_des_cord2[1] = 266;
}
if (bmatch_flag != 1) {
if (btest_des4[1].equals("lamb")) {
btest_des_cord2[0] = 307;
btest_des_cord2[1] = 45;
} else if (btest_des4[1].equals("lynn")) {
btest_des_cord2[0] = 462;
btest_des_cord2[1] = 184;
} else if (btest_des4[1].equals("tel")) {
btest_des_cord2[0] = 214;
btest_des_cord2[1] = 476;
} else if (btest_des4[1].equals("erht")) {
btest_des_cord2[0] = 63;
btest_des_cord2[1] = 181;
}
}


//System.out.println("Value = " + size);
for (i = 0; i < size; i++) {
v = 0;
test2 = test[i+2+size2].split(":");
for (v = 0; v < 3; v++)
{
V_Array[m++] = test2[v];
}
}

for (i = 0; i < bsize; i++) {
v = 0;
btest2 = test[i+2+bsize2].split(":");
for (v = 0; v < 3; v++)
{
bV_Array[m2++] = btest2[v];
}
}

}
//System.out.println("M value = " + m);

// end init()

public void paint(Graphics g) {
//System.out.println(" MATH = " + test[(test.length - 1)]);
g.setFont(bigFont);
g.drawImage(purdue,0,0,this);
g.setColor(blackColor.brighter());
g.drawLine(585,5,585,145);
g.drawLine(586,6,586,146);
g.drawLine(585,5,875,5);
g.drawLine(585,6,875,6);
g.drawLine(585,145,875,145);
g.drawLine(585,146,875,146);
g.drawLine(875,5,875,145);
g.drawLine(876,6,876,146);
g.setColor(orangeColor.darker());
g.drawString("LEGEND",706,25);
g.setColor(blackColor.brighter());
g.drawImage(router1,593,38,null);
g.drawString("CURRENT FIRST-HOP ROUTER",665,70);
g.drawImage(router2,600,90,null);
g.drawString("IDEAL FIRST-HOP ROUTER",665,116);
if (test[(test.length - 1)].equals("YES_MATCH")) {
if (test_des_cord[0] != 0) {
g.drawImage(router1,test_des_cord[0],test_des_cord[1],null);
}
for (q = 1; q < m; q = q + 3) {
V_cord = V_Array[q+1].split(",");
g.drawString(V_Array[q], Integer.parseInt(V_cord[0])+55,
Integer.parseInt(V_cord[1])+70);
}
} else {
if (test_des_cord[0] != 0) {
g.drawImage(router1,test_des_cord[0],test_des_cord[1],null);
}
for (q = 1; q < m; q = q + 3) {
V_cord = V_Array[q+1].split(",");
g.drawString(V_Array[q], Integer.parseInt(V_cord[0])+55,
Integer.parseInt(V_cord[1])+70);
}
if (test_des_cord2[0] != 0) {
g.drawImage(router2,test_des_cord2[0],test_des_cord2[1],null);
}
}

if (btest[(btest.length - 1)].equals("YES_MATCH")) {
if (btest_des_cord[0] != 0) {
g.drawImage(router1,btest_des_cord[0],btest_des_cord[1],null);
}
for (q = 1; q < m2; q = q + 3) {
bV_cord = bV_Array[q+1].split(",");
g.drawString(bV_Array[q], Integer.parseInt(bV_cord[0])+55,
Integer.parseInt(bV_cord[1])+70);
}
} else {
if (btest_des_cord[0] != 0) {
g.drawImage(router1,btest_des_cord[0],btest_des_cord[1],null);
}
for (q = 1; q < m2; q = q + 3) {
bV_cord = bV_Array[q+1].split(",");
g.drawString(bV_Array[q], Integer.parseInt(bV_cord[0])+55,
Integer.parseInt(bV_cord[1])+70);
}
if (btest_des_cord2[0] != 0) {
g.drawImage(router2,btest_des_cord2[0],btest_des_cord2[1],null);
}
}
}
} // end class PurdueTopology
15 years ago
This error too came up


java.lang.ClassFormatError: JAVA_FILES/SurfCore (Bad magic number)
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:539)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123)
at sun.applet.AppletClassLoader.findClass(AppletClassLoader.java:165)
at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
at sun.applet.AppletClassLoader.loadClass(AppletClassLoader.java:123)
at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
at sun.applet.AppletClassLoader.loadCode(AppletClassLoader.java:581)
at sun.applet.AppletPanel.createApplet(AppletPanel.java:621)
at sun.plugin.AppletViewer.createApplet(AppletViewer.java:1901)
at sun.applet.AppletPanel.runLoader(AppletPanel.java:550)
at sun.applet.AppletPanel.run(AppletPanel.java:301)
at java.lang.Thread.run(Thread.java:534)
15 years ago
The java applet I created shows the following error message when run. The file however gets compiled properly so I do not think there is an error in the code. What does the error mean. Does it mean I need a newer version of JRE?


Java(TM) Plug-in: Version 1.4.2_16
Using JRE version 1.4.2_16 Java HotSpot(TM) Client VM
User home directory = /home/lookout/j3/arane
Proxy Configuration: Browser Proxy Configuration


----------------------------------------------------
c: clear console window
f: finalize objects on finalization queue
g: garbage collect
h: display this help message
l: dump classloader list
m: print memory usage
o: trigger logging
p: reload proxy configuration
q: hide console
r: reload policy configuration
s: dump system properties
t: dump thread list
v: dump thread stack
x: clear classloader cache
0-5: set trace level to <n>
----------------------------------------------------
java.lang.UnsupportedClassVersionError: PurdueCore (Unsupported major.minor version 49.0)
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:539)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123)
at sun.applet.AppletClassLoader.findClass(AppletClassLoader.java:165)
at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
at sun.applet.AppletClassLoader.loadClass(AppletClassLoader.java:123)
at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
at sun.applet.AppletClassLoader.loadCode(AppletClassLoader.java:581)
at sun.applet.AppletPanel.createApplet(AppletPanel.java:621)
at sun.plugin.AppletViewer.createApplet(AppletViewer.java:1901)
at sun.applet.AppletPanel.runLoader(AppletPanel.java:550)
at sun.applet.AppletPanel.run(AppletPanel.java:301)
at java.lang.Thread.run(Thread.java:534)
java.lang.ClassFormatError: JAVA_FILES/PurdueCore (Bad magic number)
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:539)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123)
at sun.applet.AppletClassLoader.findClass(AppletClassLoader.java:165)
at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
at sun.applet.AppletClassLoader.loadClass(AppletClassLoader.java:123)
at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
at sun.applet.AppletClassLoader.loadCode(AppletClassLoader.java:581)
at sun.applet.AppletPanel.createApplet(AppletPanel.java:621)
at sun.plugin.AppletViewer.createApplet(AppletViewer.java:1901)
at sun.applet.AppletPanel.runLoader(AppletPanel.java:550)
at sun.applet.AppletPanel.run(AppletPanel.java:301)
at java.lang.Thread.run(Thread.java:534)
java.lang.ClassFormatError: JAVA_FILES/PurdueCore (Bad magic number)
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:539)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123)
at sun.applet.AppletClassLoader.findClass(AppletClassLoader.java:165)
at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
at sun.applet.AppletClassLoader.loadClass(AppletClassLoader.java:123)
at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
at sun.applet.AppletClassLoader.loadCode(AppletClassLoader.java:581)
at sun.applet.AppletPanel.createApplet(AppletPanel.java:621)
at sun.plugin.AppletViewer.createApplet(AppletViewer.java:1901)
at sun.applet.AppletPanel.runLoader(AppletPanel.java:550)
at sun.applet.AppletPanel.run(AppletPanel.java:301)
at java.lang.Thread.run(Thread.java:534)
15 years ago
Hey,

I think I know what your problem is. I guess you first went on the Sun website and saw thw price of $100. The second time you logged in it was the prometric site. The prometric site shows the price of SCJA as $300 but once you register on phone using your voucher number you get it for free(ofcourse you have to pay hundred for the voucher)
15 years ago
I could not understand what your question is;

I would however like to explain whatever I know about navigation. In UML you are right when A---->---B U can say that B is navigable through A. In Java Code Navigability usually means that set or get methods for the instance variable of class B are defined in A. If there are no methods accesing or mutating an object of class B in A you will see this in UML A-----B

The line shown here is a solid line...(Dont mistake with interfaces)
15 years ago
HEY,

I am sorry for that mistake , should have caught it. Sorry, have just started learning intermediate Java.

Thank you for correcting me

Amey
15 years ago
Please see the following code snippet. It is throwing an exception in the second try and catch block and prints Deserialization failed. It is however not throwing exception in the first try and catch block. Please reply as soon as you can.
============================================================================


import java.io.*;

public class Save
{

public static void main(String args[])
{

Car a = new Car(45,"Ford");
Car b = new Car(30,"Skyon");

System.out.println (" The cost of a = "+ a.cost);

try
{
ObjectOutputStream os = new ObjectOutputStream( new FileOutputStream("Amey.ser") );
os.writeObject(a);
os.writeObject(b);

System.out.println (" The file is serialized");

os.close();

}

catch(IOException e){System.out.println (" Serialization failed");}

a=null;
b=null;

try
{

FileInputStream fis = new FileInputStream("Amey.ser");
ObjectInputStream is = new ObjectInputStream( fis );
Car a2= (Car) is.readObject();
Car b2= (Car) is.readObject();

System.out.println (" The cost of a after removing it from suspended animation = "+ a.cost);
}

catch( Exception ex) {System.out.println (" Deseriliazation failed");}





}

}
15 years ago