Friday, 15 July 2011

Netbeans java applet codebase relative path -



Netbeans java applet codebase relative path -

i have directory structure:

and have code (from book reading)

<html> <head> <title>saluton mondo!</title> </head> <body bgcolor = "#000000" text = "#ff00ff" > <p> java applet.</p> <applet code ="salutonapplet.class" codebase="..\\..\\build\\classes" height="150" width="300" > <p>you need java-enabled browser see this.</p> </applet> </body> </html>

and of course of study java class - not relevant question, anyway:

import java.awt.*; public class salutonapplet extends javax.swing.japplet { string greeting; @override public void init() { greeting = "saluton mondo!"; } @override public void paint(graphics screen) { graphics2d screen2d = (graphics2d) screen; screen2d.drawstring(greeting, 25, 50); } }

and if point , click on html file windows explorer, opens default browser , applet displayed correctly:

however, want open through netbeans directly, right click-> view option, , struggle figure out relative path in netbeans do this? tried several different options won't work. of course of study if set absolute path such codebase="c:\users\nenad\documents\netbeansprojects\java24\build\classes" works, want relative path.

project construction in netbeans this:

so found problem was:

it should

codebase="..\\build\\classes"

instead of

codebase="..\\..\\build\\classes"

then surprise, if move salutonapplet.html & salutonapplet.java day17 package,

and reflect alter update codebase accordingly to

codebase="..\\..\\build\\classes\\day17"

but 1 time again have same problem? don't why? added 2 levels (from day17, , src should go java24)

c:\users\nenad\documents\netbeansprojects\java24\src\day17\

should become

c:\users\nenad\documents\netbeansprojects\java24

and

c:\users\nenad\documents\netbeansprojects\java24\build\classes\day17

should bring right should - not, why?

and 1 more question - if seek utilize embedded webkit browser gives me error "you need java-enabled browser see this" - there alternative enable or browser has no capability of beingness java enabled browser?

java netbeans applet relative-path

No comments:

Post a Comment