How to load .wrl model with its texture??

I can sucessfully add some .wrl models on the scene,but its texture cannot be shown(the path of its texture is correct)...i want to know why??

hi...
i think better you check at the directory of file you want to use... Example: url for the texture ....
Transform{ #start road
children [
Shape {
geometry Box { size 500 .05 50 }
appearance Appearance{
texture ImageTexture { url["pic\road1.jpg"] }
#textureTransform TextureTransform {rotation 90}
translation 925 -1.7 -550
}#end road 14
hope can help you

Similar Messages

  • How to create a window with its own window border other than the local system window border?

    How to create a window with its own window border other than the local system window border?
    For example, a border: a black line with a width 1 and then a transparent line with a width 5. Further inner, it is the content pane.
    In JavaSE, there seems to have the paintComponent() method for the JFrame to realize the effect.

    Not sure why your code is doing that. I usually use an ObjectProperty<Point2D> to hold the initial coordinates of the mouse press, and set it to null on a mouse release. That seems to avoid the dragging being confused by mouse interaction with other nodes.
    import javafx.application.Application;
    import javafx.application.Platform;
    import javafx.beans.property.ObjectProperty;
    import javafx.beans.property.SimpleObjectProperty;
    import javafx.collections.FXCollections;
    import javafx.event.ActionEvent;
    import javafx.event.EventHandler;
    import javafx.geometry.Point2D;
    import javafx.geometry.Pos;
    import javafx.scene.Node;
    import javafx.scene.Scene;
    import javafx.scene.control.Button;
    import javafx.scene.control.ChoiceBox;
    import javafx.scene.input.MouseEvent;
    import javafx.scene.layout.AnchorPane;
    import javafx.scene.layout.StackPane;
    import javafx.scene.layout.VBox;
    import javafx.scene.paint.Color;
    import javafx.stage.Stage;
    import javafx.stage.StageStyle;
    import javafx.stage.Window;
    public class CustomBorderExample extends Application {
      @Override
      public void start(Stage primaryStage) {
      AnchorPane root = new AnchorPane();
      root.setStyle("-fx-border-color: black; -fx-border-width: 1px; ");
      enableDragging(root);
      StackPane mainContainer = new StackPane();
        AnchorPane.setTopAnchor(mainContainer, 5.0);
        AnchorPane.setLeftAnchor(mainContainer, 5.0);
        AnchorPane.setRightAnchor(mainContainer, 5.0);
        AnchorPane.setBottomAnchor(mainContainer, 5.0);
      mainContainer.setStyle("-fx-background-color: aliceblue;");
      root.getChildren().add(mainContainer);
      primaryStage.initStyle(StageStyle.TRANSPARENT);
      final ChoiceBox<String> choiceBox = new ChoiceBox<>(FXCollections.observableArrayList("Item 1", "Item 2", "Item 3"));
      final Button closeButton = new Button("Close");
      VBox vbox = new VBox(10);
      vbox.setAlignment(Pos.CENTER);
      vbox.getChildren().addAll(choiceBox, closeButton);
      mainContainer.getChildren().add(vbox);
        closeButton.setOnAction(new EventHandler<ActionEvent>() {
          @Override
          public void handle(ActionEvent event) {
            Platform.exit();
      primaryStage.setScene(new Scene(root,  300, 200, Color.TRANSPARENT));
      primaryStage.show();
      private void enableDragging(final Node n) {
       final ObjectProperty<Point2D> mouseAnchor = new SimpleObjectProperty<>(null);
       n.addEventHandler(MouseEvent.MOUSE_PRESSED, new EventHandler<MouseEvent>() {
          @Override
          public void handle(MouseEvent event) {
            mouseAnchor.set(new Point2D(event.getX(), event.getY()));
       n.addEventHandler(MouseEvent.MOUSE_RELEASED, new EventHandler<MouseEvent>() {
          @Override
          public void handle(MouseEvent event) {
            mouseAnchor.set(null);
       n.addEventHandler(MouseEvent.MOUSE_DRAGGED, new EventHandler<MouseEvent>() {
          @Override
          public void handle(MouseEvent event) {
            Point2D anchor = mouseAnchor.get();
            Scene scene = n.getScene();
            Window window = null ;
            if (scene != null) {
              window = scene.getWindow();
            if (anchor != null && window != null) {
              double deltaX = event.getX()-anchor.getX();
              double deltaY = event.getY()-anchor.getY();
              window.setX(window.getX()+deltaX);
              window.setY(window.getY()+deltaY);
      public static void main(String[] args) {
      launch(args);

  • LOAD VILLA MODEL WITH TEXTURES

    HI FOR ALL
    FIRST I HAVE A PROBLEM IN MY GRADUATION PROJECT I WANT TO LOAD A 3D VILLA MODELS WITH TEXTURES
    I LOADED MODELS BUT TEXTURES DID NOT APPEAR PLEASE CAN ANY ONE HELP ME
    SECOND I WANT TO PUT THE JAVA 3D APPLET ON A WEBSITE HOW CAN I PUT THE J3D APPLET IN HTML DOC ??

    This is my appleT
    {code */
    public class OnAppletView extends Applet {
        public BranchGroup createSceneGraph(SimpleUniverse su) throws MalformedURLException {
    //        String objUrl="";
    //         Connection conn=null;
    //          String UserName="root";
    //          String Password="password";
    //          String Url="jdbc:mysql://localhost/City";
    //                ResultSet rs=null;
    //                try
    //          Class.forName("com.mysql.jdbc.Driver").newInstance();
    //          conn=DriverManager.getConnection(Url,UserName,Password);
    //          System.out.println("Database connection established");
    //          Statement s=conn.createStatement();
    //          s.executeQuery("select url from resources where obj1='villa' ");
    //          rs=s.getResultSet();
    //                if(rs!=null)
    //              try
    //              while(rs.next())
    //                   objUrl=rs.getString(1);
    //                        System.out.println("objjjj"+objUrl);
    //          catch (Exception e) {
    //                    // TODO: handle exception
    //               e.printStackTrace();
    //          s.close();
    //          conn.close();
    //          System.out.println("DB Connection terminated");
    //          catch (Exception e) {
    //               e.printStackTrace();
    // Create the root of the branch graph
    TransformGroup vpTrans = null;
    BranchGroup objRoot = new BranchGroup();
    ObjectFile f = new ObjectFile(ObjectFile.RESIZE | ObjectFile.TRIANGULATE | ObjectFile.STRIPIFY );
    Scene s = null;
    try {
    // f.setBaseUrl( new URL("file:///"));
    // s = f.load(new URL("file:///C:/Users/Mido/Desktop/ObjectLoader/villa1/villa1.obj"));
    // f.setBaseUrl(new URL("file:///C:/Users/Mido/Desktop/OBJ-Models/Unterstand&Carport/"));
    // s = f.load(new URL("file:///C:/Users/Mido/Desktop/OBJ-Models/house/casa1/casa1.obj"));
    f.setBasePath("C:\\Users\\Mido\\Desktop\\NewVilla\\");
    s = f.load("C:\\Users\\Mido\\Desktop\\NewVilla\\House02b.obj");
    } catch (FileNotFoundException e) {
    System.err.println(e);
    System.exit(1);
    } catch (ParsingErrorException e) {
    System.err.println(e);
    System.exit(1);
    } catch (IncorrectFormatException e) {
    System.err.println(e);
    System.exit(1);
    /// objRoot.addChild(s.getSceneGroup());
    Vector3f translate = new Vector3f();
    Transform3D T3D = new Transform3D();
    TransformGroup TG = null;
    SharedGroup share = new SharedGroup();
    share.addChild(s.getSceneGroup());
    float[][] position = {{0.0f, -0.1f, -3.0f},
    {6.0f, -0.1f, 0.0f},
    {6.0f, -0.1f, 6.0f},
    {3.0f, -0.1f, -10.0f},
    {13.0f, -0.1f, -30.0f},
    {-13.0f, -0.1f, 30.0f},
    {-13.0f, -0.1f, 23.0f},
    {13.0f, -0.1f, 3.0f}};
    for (int i = 0; i < position.length; i++) {
    translate.set(position);
    T3D.setTranslation(translate);
    TG = new TransformGroup(T3D);
    TG.addChild(new Link(share));
    objRoot.addChild(TG);
    vpTrans = su.getViewingPlatform().getViewPlatformTransform();
    translate.set(0.0f, 0.3f, 0.0f);
    T3D.setTranslation(translate);
    vpTrans.setTransform(T3D);
    KeyNavigatorBehavior keyNavBeh = new KeyNavigatorBehavior(vpTrans);
    keyNavBeh.setSchedulingBounds(new BoundingSphere(new Point3d(), 1000.0));
    objRoot.addChild(keyNavBeh);
    objRoot.compile();
    return objRoot;
    } // end of CreateSceneGraph method of KeyNavigatorApp
    public void init() {
    // TODO start asynchronous download of heavy resources
    setLayout(new BorderLayout());
    GraphicsConfiguration config =
    SimpleUniverse.getPreferredConfiguration();
    Canvas3D canvas3D = new Canvas3D(config);
    add("Center", canvas3D);
    // SimpleUniverse is a Convenience Utility class
    SimpleUniverse simpleU = new SimpleUniverse(canvas3D);
    BranchGroup scene=null;
    try {
    scene = createSceneGraph(simpleU);
    } catch (MalformedURLException ex) {
    Logger.getLogger(OnAppletView.class.getName()).log(Level.SEVERE, null, ex);
    // LIGHT
    AmbientLight ambientLight = new AmbientLight(new Color3f(Color.black));
    ambientLight.setInfluencingBounds(new BoundingSphere(new Point3d(), 100.0));
    DirectionalLight directionalLight = new DirectionalLight(new Color3f(Color.WHITE), new Vector3f(0.0f, 0.0f, -1.0f));
    directionalLight.setInfluencingBounds(new BoundingSphere(new Point3d(), 100.0));
    BranchGroup lightingBG = new BranchGroup();
    lightingBG.addChild(ambientLight);
    lightingBG.addChild(directionalLight);
    PlatformGeometry platformGeometry = new PlatformGeometry();
    platformGeometry.addChild(lightingBG);
    simpleU.getViewingPlatform().setPlatformGeometry(platformGeometry);
    //END OF LIGHT
    // This will move the ViewPlatform back a bit so the
    // objects in the scene can be viewed.
    simpleU.getViewingPlatform().setNominalViewingTransform();
    // TO INTERACT WITH MOUSE
    // OrbitBehavior orbitBehavior = new OrbitBehavior(canvas3D , OrbitBehavior.REVERSE_ALL);
    // orbitBehavior.setBoundsAutoCompute(true);
    // orbitBehavior.setSchedulingBounds(new BoundingSphere(new Point3d() , 100.0));
    // simpleU.getViewingPlatform().setViewPlatformBehavior(orbitBehavior);
    simpleU.addBranchGraph(scene);
    // TODO overwrite start(), stop() and destroy() methods
    i wanT To implemenT a collision detection to prevent the viewer to walk through the wall what can i do ? there is a class ??                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Loading Obj file with its .mtl

    Hai guys,
    I am new to java3D. I need to load the .obj which has the .mtl and the respective pics for its texture.(The .obj file .mtl and the relevant pics are all in the same folder) The Problem is obj file is being loaded but the output we got is no where near what we see in 3DMax. What is the problem?. Where i am going wrong.
    Thanks in Advance,
    Prakash Anandaraj. C

    D'Oh!
    First post, and already posted the wrong code...
    This is the right code, where I load the OBJ-Model:
    public void UseOBJModel(String path)
            ObjectFile loader = new ObjectFile();
            Shape3D shape = new Shape3D();
            try
                Scene tmpScene = loader.load(path);
                 Enumeration children = tmpScene.getSceneGroup().getAllChildren();
                 Shape3D tmp = (Shape3D)children.nextElement();
                 shape.setGeometry(tmp.getGeometry(),0);//This for killing the leading null in the GeometryList
                //Combining all Shape3Ds from the OBJ-Model into one single shape
                while(children.hasMoreElements())
                    tmp = (Shape3D)children.nextElement();
                     shape.addGeometry(tmp.getGeometry());      
                //TODO: Hard setting of Color for OBJ-Shape.Can be improved later
                Appearance objApp = new Appearance();
                Material objMat = new Material();
                ColoringAttributes col = new ColoringAttributes();
                objMat.setAmbientColor(new Color3f(.3f,.3f,.3f));
                objMat.setDiffuseColor(new Color3f(.5f,.5f,.5f));
                objMat.setSpecularColor(new Color3f(.6f,.6f,.6f));
                objMat.setLightingEnable(true);
                objApp.setMaterial(objMat);
                objApp.setColoringAttributes(col);
                col.setColor(.6f,.6f,.6f);
                shape.setAppearance(objApp);
                SetOriginalShape(shape);
            catch(FileNotFoundException e)
                System.err.println("Something went wrong while loading OBJ-File");
        }Sorry...

  • How to load a sysdate with flat file

    How do I load a sysdate with a flat file
    I tried using a constant with a sysdate expression but it seems like OWB creates the ctl file with 'sysdate' as a text and not as a sysdate() function

    Ola Wernere,
    Two things to check:
    - is the data type of the constant a date?
    - did you enter 'sysdate' or just sysdate (without the ampersands)?
    Other thing that might help you is generate the intermediate result in the mapping. This will show you the results you'll expect to be loaded in the flat file...
    Good luck & regards
    Moscowic

  • How to load external DLLs with C++ interface in TestStand?

    Hi,
    Can you please let me know how would I load external DLLs with C++ interface in TestStand?
    Regards.

    TestStand 3.x can only call static class C++ methods. TestStand cannot call methods on a C++ object because TestStand does not know how to enstantiate the C++ object.  In TestStand 3.x, there is a online help topic called "Exporting Class Methods and Functions in Visual Studio .NET".
    Scott Richardson
    National Instruments

  • How to load my tree with data from SQL database????

    Hello friends
    May i know how i can load my tree with my database??
    i have 3 different tables and i need them to be the 3 main nodes of my tree
    They are
    1.fiche
    2.amis and
    3.famille
    and in each of these nodes need to load the 3 databases
    thank u in advance

    Heres my program so i loaded my vector ,
    Now how can i integrate the coding u gave me, and where ??
    Is it where i put the quetion mark?
    if so
    can you tell me how?? because i didnt understood well the codings you gave me as im nt at all familiar with this
    Thank you in advance
    public class carnetf extends javax.swing.JFrame  {
       DefaultMutableTreeNode root =null;
        public carnetf() {
           root= new DefaultMutableTreeNode("Carnet");
            DefaultMutableTreeNode tnFiche=new DefaultMutableTreeNode("Fiche");
           root.add( tnFiche);
            DefaultMutableTreeNode tnAmis=new DefaultMutableTreeNode("Amis");
            root.add( tnAmis);
            DefaultMutableTreeNode tnFamille=new DefaultMutableTreeNode("Famille");
            root.add( tnFamille);
           initComponents();
        public Vector vecfiche() {
            Vector v = new Vector();    
            Connection connection = null;
            try
                Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
                DriverManager.registerDriver(new com.microsoft.jdbc.sqlserver.SQLServerDriver());;
            catch (Exception E)
                System.out.println("Unable to load driver.");
                System.out.println(E.getMessage());
                E.printStackTrace();
                return null;
            try
                connection = DriverManager.getConnection( "jdbc:microsoft:sqlserver://localhost:1433;user=sa;password=sa;DatabaseName=carnet");
            catch (Exception E)
                System.out.println("Unable to connect.");
                System.out.println(E.getMessage());
                return null;
            try
                Statement Stmt = connection.createStatement();
                if(jRadioButton1.isSelected()==true)  
                    String Query = "SELECT * FROM fiche";
                ResultSet RS= Stmt.executeQuery( Query );
                while ( RS.next())
                 v.add( new vecfiche( RS.getString("Nom"), RS.getString("Prenom")));
                if( RS!= null) RS.close();}
                if(jRadioButton2.isSelected()==true)  
                    String Query = "SELECT * FROM amis";
                ResultSet RS= Stmt.executeQuery( Query );
                while ( RS.next())
                 v.add( new vecfiche( RS.getString("Anom"), RS.getString("Aprenom")));
                if( RS!= null) RS.close();}
                if(jRadioButton3.isSelected()==true)  
                    String Query = "SELECT * FROM famille";
                ResultSet RS= Stmt.executeQuery( Query );
                while ( RS.next())
                 v.add( new vecfiche( RS.getString("Fnom"), RS.getString("Fprenom")));
                if( RS!= null) RS.close();}
                if( Stmt!= null) Stmt.close();
            catch (Exception E)
                System.out.println("Unable to query.");
                System.out.println(E.getMessage());
                return null;
            try
                connection.close();
            } catch (Exception E)
                System.out.println("Unable to close.");
                System.out.println(E.getMessage());
                return null;
            return v;
        }

  • How to load a file with out specifying its absolute location

    Hi,
    I'm having some config files in a specific location. I'm setting that folder path to the CLASSPATH and trying access those file just by giving its name.
    For eg: contents are in e:\config folder
    I set e:\config to CLASSPATH
    and trying to load the file which is in the above said folder.
    using getResourceAsStream(filename).
    The above approach is working in certain cases, but not working when i try to do in a class which under a big package structure.
    Can someone help me out, the reason for this unexpected behaviour.
    Please do suggest me, if u know some work-around for this problem.
    Thnaks in advance,
    Chandrasekhar

    Hi,
    Thank you. I tried by adding a forward slash, it started working.
    But I still have one doubt, when the program is within the package structure, then we have to give forward slash, where as if the program doesn't have any pkg structure we have to give only the file name without prefixing the slash.
    Any idea, why is it so ??
    Is it bcz, that getOutputAsStream() will prepend the package names, if forward slash is not given. Even if this is true, why providing a forward slash in a program with no packages doesn't work ?

  • How to load master data with text into infoObject in BI 7.0

    Hi all;
    I have an infoobject 0employee ( this is for employee number ,8 character long), with medium text option.
    I would like to load Employee name as a text option for employee number.
    How do I load this mater data into this 0employee object,
    Please help.
    I did look for something similar in the forum and there are many of them, but I couldn't find anything that for BI 7.0 and really clear help for me. Sorry to ask a question that been asked before.
    thanks.
    Raiine

    hi rainnie,
    check this link t oload master data in BI 7
    Re: BI 7.0 flat File extraction
    as you are using SAP defined infoobject you can start from the creation of datasource.
    text format for the flat file is
    LANGUAGE,INFOOBJECT,TEXT
    EN,0EMPLOYEE,RAINNIE
    You have to create ,infopakage, transformation ,dtp for both the attribute and text.
    hope this helps
    cheers
    Sunil

  • How to load an applet with 2 classes and get it to display properly

    Ok I am a very newbie as you can tell by code below but I need help duh. I am a student taking a Java course on my own (ie no marks) so I know what I am doing in a second level java courseI am not sure if my problem is with "Forte for Java 4, CE" or my code. I have two files. Door.java and Exercise4a.java
    The code is as follows:
    Door.java
    package Exercise4.Exercise4a;
    import java.awt.*;
    import java.applet.*;
    public class Door extends java.applet.Applet {
    /** Creates a new instance of Door */
    int x;
    int y;
    public void init() {
    Graphics b;
    public Door(Point aPoint)
    x = (int)aPoint.getX();
    y = (int)aPoint.getY();
    public void paint(Graphics graphics)
    graphics.drawRect(0 + x ,0 + y, 20,30);
    graphics.setColor(Color.black);
    graphics.fillOval(15 + x,15 + y ,5,5);
    graphics.drawImage(buffer,0,0,this);
    public static void main(String args[]){}
    and Exercise4a.java
    package Exercise4.Exercise4a;
    import java.awt.*;
    import java.applet.*;
    public class Exercise4a extends java.applet.Applet {
    Graphics b;
    public void init() {
    Point a = new Point(0,0);
    Door door = new Door(a);
    My problem is that I do not see my door when I compile either file.
    What am I doing wrong? Is this acode problem. ie how do I load the graphics or is it that I am not compiling it correctly.

    package Exercise4.Exercise4a;
    import java.awt.*;
    import java.applet.*;
    public class Exercise4a extends java.applet.Applet {
    Graphics b;
    public void init() {
    Point a = new Point(0,0);
    Door door = new Door(a);// door.paint (b)

  • Fglrx: How to load intel driver with various options, e.g. AccelMethod

    Hi,
    When using fglrx and pxpress on a system with hybrid graphics, how can options be set for the intel device?
    Normally in the "xorg.conf" I could just put something like
    Section "Device"
    Identifier "Intel Graphics"
    Driver "intel"
    Option "AccelMethod" "sna"
    EndSection
    But with fglrx installed the xorg.conf looks like
    Section "ServerLayout"
    Identifier "Radeon Layout"
    Screen 0 "aticonfig-Screen[0]-0" 0 0
    EndSection
    Section "Monitor"
    Identifier "aticonfig-Monitor[0]-0"
    Option "VendorName" "ATI Proprietary Driver"
    Option "ModelName" "Generic Autodetecting Monitor"
    Option "DPMS" "true"
    EndSection
    Section "Device"
    Identifier "aticonfig-Device[0]-0"
    Driver "fglrx"
    BusID "PCI:6:0:0"
    EndSection
    Section "Screen"
    Identifier "aticonfig-Screen[0]-0"
    Device "aticonfig-Device[0]-0"
    Monitor "aticonfig-Monitor[0]-0"
    DefaultDepth 24
    SubSection "Display"
    Viewport 0 0
    Depth 24
    EndSubSection
    EndSection
    (Adding an intel device section in here would cause major problems(I get segfaults). I guess because both fglrx/pxpress and xorg try to launch the i915 driver)
    So how can I configure options for the intel driver?
    Why do I want to do this?
    Well aside from the ability to tweak the integrated GPU performance in the usual manner, I have a bug that occurs when UXA is used as the accleration method, but not when SNA is used for the intel driver (even before fglrx is installed on the system). Without fglrx SNA is the default anyway, but fglrx for some reason likes to use UXA.
    Last edited by fpghost84 (2014-01-27 15:16:34)

    Hi, thanks for the new link. Yes, this is completely relevant, but unfortunately it's incomplete & didn't work for me. Please pass this along to the documentation team. Referring to the document, here are the steps I followed:
    A) Starting at section "Restore your computer when Windows 8 cannot start normally" ...
    B) I turned the laptop on & pressed F11 : "System Recovery"
    C) Spinning dots never end, just like during normal start-up, as I reported in original post 
    D) -> Document should mention the option of booting from Windows 8 installation DVD
    E) Booting from Windows 8 DVD, I was able to reach step 7 : "On the Advanced options screen, click System Restore ."
    F) I was unable to reach step 8 in the section :  "Click Windows 8 as the target operating system." b/c I need to load the Intel storage driver for the RAID array that's configured in the BIOS, so that System Restore can see my hard drive.
    How can I load that driver??
    Thanks,
    Brad

  • How to load an applet with older version of JRE?

    Hi All,
    I'm writing an applet which should read the username from the user's system using System.getProperty("user.name") method. I've JRE 1.4.2 in my browser, and it's throwing a AccessControlException whenever the applet is trying to read the "user.name" system property. So, I want to load this particular applet with an older version of JRE, say JRE 1.3. I've tried various approaches like,
    <jsp:plugin type="applet" code="LoginApplet.class" archive="login.jar"
         jreversion="1.3"     iepluginurl="http://java.sun.com/products/plugin/1.3/jinstall-13-win32.cab#Version=1,3,0,0">
    </jsp:plugin>
    and also tried OBJECT tag,
    <OBJECT
    classid="clsid:CAFEEFAC-0013-0000-0000-ABCDEFFEDCBA" codebase="http://java.sun.com/products/plugin/1.3/jinstall-13-win32.cab#Version=1,3,0,0"
         width="200" height="200" align="baseline" >
    <PARAM NAME="code" VALUE="LoginApplet.class">
    <PARAM NAME="archive" VALUE="login.jar">
    <PARAM NAME="type" VALUE="application/x-java-applet;version=1.3">
    <PARAM NAME="scriptable" VALUE="true">
    No Java 2 SDK, Standard Edition v 1.3 support for APPLET!!
    </OBJECT>
    I've not tried the simple APPLET tag because we can't specify a java plugin using the APPLET tag.
    In both the above methods, I'm still getting AccessControlException. In Java console, I'm seeing Java Plugin as 1.4.2.
    Can someone tell me is it possible to read the "user.name" system property from user's machine using Applets? If yes, how?
    Thanks,
    Tarun.

    Applets are prevented from doing certain things - reading data is one - to maximize security. You can either add permissions to the computer that the applet is running on, or you can sign the applet.
    See
    http://java.sun.com/docs/books/tutorial/security1.2/tour1/step2.html
    and
    http://forum.java.sun.com/thread.jspa?threadID=686184&tstart=45

  • When executing an external app, how do I keep stdout with its child process

    I running an external application from java, but I want the stdout to remain with the child process. This app spawns its own output window where it displays its own output and error messages. I'm running the app using the following code:
    Process p = Runtime.getRuntime().exec(command, null, workingDirectory);
    But the Process class grabs the stdout and stderr of the application it runs and holds on to them.
    Any suggestions on how can I still run the program without Java grabbing the application's stdout and stderr streams?

    In Windows, this works for me.
    I don't remember why it is so convoluted, but this is what I came up with:
    // Closes after completion
    Runtime.getRuntime().exec(
            new String[] { "cmd", "/C", "start", "/WAIT", "cmd", "/C", command } ).waitFor();
    // Waits for you to close the command prompt window
    Runtime.getRuntime().exec(
             new String[] { "cmd", "/C", "start", "/WAIT", "cmd", "/K", command } ).waitFor();where command can be any internal command, executable, batch file.
    Edited by: baftos on Feb 2, 2009 4:31 PM

  • How to query UML models with OCL?

    Hello everyone,
    I am working on using OCL to query UML models.
    Besides diverse examples, I don't know how certain UML metamodel elements are accessed via OCL when an instance model is given.
    Where am I supposed to look after this information?

    Hi
    Perhaps you want
    Transition.allInstances().extension_ensureRole->excluding(null).role
    Regards
    Ed Willink
    On 17/07/2015 10:58, Jens Bürger wrote:
    > Thanks,
    >
    > so for now I will use Mars.
    >
    > I managed to get close to what I want in a first test case.
    > I have a state chart and a transition with a stereotype <<ensureRole>>.
    > This stereotype has a tagged value "role" which is represented as a
    > String array. The actual only element is "a=b".
    >
    > I use the following query:
    > Transition.allInstances()->select(t |
    > t.getAppliedStereotypes().name->includes('ensureRole')).getAppliedStereotypes().getAllAttributes()->select(x|x.name='role')
    >
    > The result is:
    > ensureRole::ensureRole::role
    >
    > So how can I access the tagged values?
    > The respective part of the .uml-file looks like this:
    >
    > ..
    > </uml:Model>
    > <ensureRole:ensureRole xmi:id="_e75g0Cu0EeWNw6GF_Fgubg"
    > base_Transition="__AaxQIRzEeSbXcAiNcJFPQ">
    > <role>a=b</role>
    > <role>x=y</role>
    > </ensureRole:ensureRole>
    > </xmi:XMI>
    >
    >

  • Linux JVM: How to load shared libraries with mutual/circular dependencies

    Hi,
    I am using the API
    System.loadLibrary(String name)
    to dynamically link shared libaries to Linux JVM.
    The shared libraries has complex circular symbol dependencies among them.
    I am not able to load shared libraries due to java.lang.UnsatisfiedLinkError.
    Any ideas on how a number of shared libraries with interdependent realtionships
    could be successfully linked in to the Linux JVM?
    Thanks,
    Soumen.
    Background
    ===========
    Successful execution of native code within Java virtual machine in a
    host platform, has two necessary prerequisites:
    Prerequisite 1: The native code is written to the JNI specification
    Prerequisite 2: The native code is dynamically linked with Java virtual
    machine.
    The second step is achieved via simple Java interface, System.loadLibrary:
    http://java.sun.com/j2se/1.4.2/docs/api/java/lang/System.html#loadLibrary(java.lang.String)
    However, implementation of this interface is highly platform dependent
    in regards to exact nature of dynamic linking process.
    Tests
    =====
    I made three shared libraries libfeatureA.so, libfeatureB.so and libfeatureC.so.
    Feature A and Feature B are mutually dependent on each other (i.e cicular
    dependencies between libfeatureA.so, libfeatureB.so) whereas libfeatureC.so
    has no external dependencies.
    Case 1
    I could link libfeatureC.so with java.
    Case 2
    Java failed to resolve circular dependency between libfeatureA.so, libfeatureB.so
    resulting in linking failure. There may be repackaging workarounds which I have
    not yet explored.
    Java source code
    ================
    class TestLoadLibrary
    static
    System.loadLibrary("featureB");
    System.loadLibrary("featureA");
    System.loadLibrary("featureB");
    public static void main(String[] args)
    System.out.println("In TestLoadLibrary.main()");
    Exception in thread "main" java.lang.UnsatisfiedLinkError: /homes/soumen/work/event/featureB/libfeatureB.so.1.0: /homes/soumen/work/ev B.so.1.0: undefined symbol: featureA_func2
    at java.lang.ClassLoader$NativeLibrary.load(Native Method)
    at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1737)
    at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1662)
    at java.lang.Runtime.loadLibrary0(Runtime.java:817)
    at java.lang.System.loadLibrary(System.java:986)
    at TestLoadLibrary.<clinit>(TestLoadLibrary.java:5)

    The use of "dlopen() application programming" to achieve dynamic link closure works if there are
    no circular dependencies. For example, I have the following dependency:
    libfeatureD.so ==> libfeatureC.so
    Even if I call Java APIs in correct dependency order, i.e.,
    System.loadLibrary("featureC");
    System.loadLibrary("featureD");
    there would be java.lang.UnsatisfiedLinkError for call System.loadLibrary("featureD").
    Now, I have a JNI method implementation, which makes native API call in same dependency order:
    dlopen("libfeatureC.so", RTLD_LAZY|RTLD_GLOBAL);
    dlopen("libfeatureD.so", RTLD_LAZY|RTLD_GLOBAL);
    and now System.loadLibrary calls succeed. Note that I had to set environment
    variable LD_LIBRARY_PATH so that dlopen call would find libraries to load.
    In other words, from a JNI programming point of view, "linking chasm" has been crossed.
    I am looking at circular dependency issue, i.e.,
    libfeatureA.so <==> libfeatureB.so
    There may be library repackaging workaround.
    If anybody knows any workaround, please post.
    -Soumen Sarkar
    JNI code
    ========
    #include <jni.h>
    #include "TestLoadLibrary.h"
    #include <stdio.h>
    #include <string.h>
    #include <dlfcn.h>
    JNIEXPORT void JNICALL Java_TestLoadLibrary_libLoadNative
    (JNIEnv * jenv, jclass class, jobjectArray libNames)
    printf("native: In TestLoadLibrary.libLoadNative()\n");
    char linuxLibName[1024];
    jsize idx = 0;
    jsize nLibs = (*jenv)->GetArrayLength(jenv, libNames);
    for(idx = 0; idx < nLibs; ++idx)
    /* obtain the current object from the object array */
    jobject myObject = (*jenv)->GetObjectArrayElement(jenv, libNames, idx);
    /* Convert the object just obtained into a String */
    const char libName = (jenv)->GetStringUTFChars(jenv,myObject,0);
    strcpy(linuxLibName, "lib");
    strcat(linuxLibName, libName);
    strcat(linuxLibName, ".so");
    printf("\nnative: Trying to open lib with name %s\n", linuxLibName);
    void* handle = dlopen(linuxLibName, RTLD_LAZY|RTLD_GLOBAL);
    if(handle == 0)
    fputs ("\nnative: Could not load lib\n", stderr);
    fputs (dlerror(), stderr);
    else
    printf("\nnative: Loaded lib %s\n", linuxLibName);
    /* Free up memory to prevent memory leaks */
    (*jenv)->ReleaseStringUTFChars(jenv, myObject, libName);
    return;

Maybe you are looking for

  • FICO : AR&AP Down Payment

    Dear Friends, Can anybody share , how to clear vendor and customer down payment against invoice? Regards, Perumal

  • How to call back to C via JNI in Java started from C?

    Hi! This problem might seem outlandish, but I have not been able to find any other method to reach my goal. The situation is the following. There is a C++ program I intend to interface with a piece of Java code, called the manager. The C++ code invok

  • Check whether the checkbox in a form is checked or not using javascript

    when we click a check box (TBD) it should set the value of a field to a default value '1234'. If we uncheck the checkbox, it should set the field as Null. I have defined the checkbox as STATIC2:;1234 in form. I used the onClick event on the checkbox

  • WRE54G v3 - WEP key setting when using ASCII passphrase

    When entering WEP information for this device you may notice that the range expander is asking for the WEP key in hex (for example: 128 bits 26 hex digits). If the key that you have set in your router is using a passphrase then you will need to conve

  • Error in mass settlement of rebate agreements

    Dear Friends, I am facing the following problem while doing the mass settlement of rebate agreements while Going with VB(7 T.code for mass settlement system is giving information message "No rebate agreement was selected" But i gave rebate agriment n