What I did was basically follow the OP's answer, but I had beforehand to create the .jar file. To do so, I just prepared my custom class in test.java:

import java.lang.System;

public class Test {
    public static void main(String[] args) {
        System.out.println("Hello, world!");
    }
}

And then

javac Test.java
jar cf test.jar Test.class

Now you should see the .jar created. From this point, you are able to access it from Javascript:

let java= require('java');
java.classpath.push('test.jar');

let test = java.import("Test");
test.main(null) // should print "Hello, World!"
Answer from testing_22 on Stack Overflow
🌐
Stack Overflow
stackoverflow.com › questions › 53346556 › java-program-cant-find-symbol-class-node-but-i-imported-it
import - java program can't find symbol class Node but I imported it - Stack Overflow
The Node class from java.util.LinkedList would need to be accessed as java.util.LinkedList.Node (or just LinkedList.Node if you import java.util.*).
🌐
CodeSpeedy
codespeedy.com › home › implement linked list in java using node class
LinkedList in Java using Node Class - CodeSpeedy
June 3, 2019 - It reaches to the position where we want to add the node by .next and adds. ... //import java.util.LinkedList; public class Runner { public static void main(String[] args) { Linkedlist list=new Linkedlist(); list.insert(18); list.insert(7); list.insert(15); list.insertAtStart(25); list.insertAt(2,55); list.delete(2); list.show(); } }
🌐
Chegg
chegg.com › engineering › computer science › computer science questions and answers › import java.io.*;import java.util.*;class node{//definition of node nodedata data; node next; node(nodedata d){ data = d; next = null; }}//end class nodeclass stack{ node top = null; public boolean empty(){ return top == null; }//end empty method public void push(nodedata nd){ node p = new node(nd);
import java.util. - end class Nodeclass Stack{ Node top = null
February 27, 2009 - import java.io.*; import java.util.*; class Node{//definition of node NodeData data; Node next; Node(NodeData d){ data = d; next = null; } }//end class Node class Stack{ Node top = null; public boolean empty(){ return top == null; }//end empty method public void push(NodeData nd){ Node p = new Node(nd); p.next = top; top = p; }//end push public NodeData pop(){ if(this.empty()){ System.out.printf("\nStack Empty"); System.exit(2); } NodeData hold = top.data; top = top.next; return hold; }//end pop }//end class Stack class NodeData{ char ch; int num; NodeData(char c){ ch = c; } NodeData(int n){ n
🌐
Oracle
docs.oracle.com › javase › 8 › docs › api › org › w3c › dom › Node.html
Node (Java Platform SE 8 )
July 21, 2026 - Returns a duplicate of this node, i.e., serves as a generic copy constructor for nodes. The duplicate node has no parent ( parentNode is null) and no user data. User data associated to the imported node is not carried over. However, if any UserDataHandlers has been specified along with the ...
🌐
Java2s
java2s.com › Tutorials › Java › org.w3c.dom › Document › Java_Document_importNode_Node_importedNode_boolean_deep_.htm
Java Tutorial - Java Document.importNode(Node importedNode, boolean deep)
// w w w . j av a 2 s . c o m //An ... import org.w3c.dom.Node; import org.w3c.dom.Element; import org.xml.sax.InputSource; import org.xml.sax.SAXException; import javax.xml.parsers.ParserConfigurationException; import java.io.*; public class DOMImport { static public void ...
Author: joeferner
🌐
GitHub
github.com › joeferner › node-java › issues › 430
error when using the import java class · Issue #430 · joeferner/node-java
April 20, 2018 - I have a java dependency that I need to add to my nodeJS application. I manage to run all the commands in the tutorial and my code look like this: var java = require("java"); java.classpath.push("commons-lang3-3.6.jar"); java.classpath.push("commons-io-2.4.jar"); var ArrayList = java.import('ja...
Author: joeferner
Find elsewhere
🌐
Learneroo
learneroo.com › modules › 26 › nodes › 193
Importing Classes - Learneroo
The import statement consists of 3 parts: the import keyword, the Package name, and the Class name. A package is a collection of related Java classes. The standard Java library is organized into many different packages. To import a Class, you need to specify the package that it belongs to so ...
🌐
Java Code Geeks
examples.javacodegeeks.com › home › java development › core java
Java Node Example - Java Code Geeks
September 20, 2021 - The following Code snippet will show the structure of the Node Class in N-ary Tree and Trie Linked List. ... import java.util.ArrayList; import java.util.List; public class NaryTreeNode { public NaryTreeNode parentNode; // The parent of the current node public List<NaryTreeNode> childList; // The children's of the current node public String dataValue; public NaryTreeNode getParentNode() { return parentNode; } public void setParentNode(NaryTreeNode parentNode) { this.parentNode = parentNode; } public List<NaryTreeNode> getChildList() { return childList; } public void setChildList(List<NaryTreeN
🌐
Medium
javafullstackdev.medium.com › java-nodes-explained-essential-building-blocks-for-linked-lists-trees-and-graphs-93b1163f922e
Java Nodes Explained: Essential Building Blocks for Linked Lists, Trees, and Graphs | by fullstackjavadev.in | Medium
June 2, 2024 - A node in a graph might look like this: import java.util.List; import java.util.ArrayList; public class GraphNode { int data; List<GraphNode> neighbors; // Constructor public GraphNode(int data) { this.data = data; this.neighbors = new ...
🌐
npm
npmjs.com › package › java
java - npm
October 18, 2025 - The resulting v8 object will then be returned to the callers callback function. The JavaScript object returned by java.import(classname) is a JavaScript constructor Function, implemented such that you can create instances of the Java class.
      » npm install java
    
Published: Oct 18, 2025
Version: 0.18.0
🌐
GitHub
gist.github.com › jakswa › 298554
Node.java · GitHub
Node.java · This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters ·
🌐
University of Colorado Boulder
home.cs.colorado.edu › ~main › docs › edu › colorado › nodes › Node.html
Node
Each node contains a piece of data (which is a reference to an E object) and a link (which is a reference to the next node of the list). The reference stored in a node can be null. ... Java Source Code for this class (www.cs.colorado.edu/~main/edu/colorado/nodes/Node.java) , BooleanNode, ByteNode, CharNode, DoubleNode, FloatNode, IntNode, LongNode, ShortNode
🌐
Oracle
docs.oracle.com › javase › 7 › docs › api › org › w3c › dom › Node.html
Node (Java Platform SE 7 )
Returns a duplicate of this node, i.e., serves as a generic copy constructor for nodes. The duplicate node has no parent ( parentNode is null) and no user data. User data associated to the imported node is not carried over. However, if any UserDataHandlers has been specified along with the ...
🌐
Medium
medium.com › graalvm › using-testcontainers-from-a-node-js-application-3aa2273bf3bb
Using Java libraries from a Node.js application. Testcontainers example. | by Oleg Šelajev | graalvm | Medium
March 26, 2019 - The same applies to a node.js application; you need a module, you add a dependency and npm handles the rest. However, npm doesn’t currently resolve Maven dependencies (at least I don’t know if it can do it), so we need to prepare a JAR file with all the necessary classes. Clone the example Java application that uses Testcontainers and build an uberjar that contains Testcontainers and all its dependencies.
Top answer
1 of 1
11

Welcome to Java! This Nodes are like a blocks, they must be assembled to do amazing things! In this particular case, your nodes can represent a list, a linked list, You can see an example here:

public class ItemLinkedList {
    private ItemInfoNode head;
    private ItemInfoNode tail;
    private int size = 0;

    public int getSize() {
        return size;
    }

    public void addBack(ItemInfo info) {
        size++;
        if (head == null) {
            head = new ItemInfoNode(info, null, null);
            tail = head;
        } else {
            ItemInfoNode node = new ItemInfoNode(info, null, tail);
            this.tail.next =node;
            this.tail = node;
        }
    }

    public void addFront(ItemInfo info) {
        size++;
        if (head == null) {
            head = new ItemInfoNode(info, null, null);
            tail = head;
        } else {
            ItemInfoNode node = new ItemInfoNode(info, head, null);
            this.head.prev = node;
            this.head = node;
        }
    }

    public ItemInfo removeBack() {
        ItemInfo result = null;
        if (head != null) {
            size--;
            result = tail.info;
            if (tail.prev != null) {
                tail.prev.next = null;
                tail = tail.prev;
            } else {
                head = null;
                tail = null;
            }
        }
        return result;
    }

    public ItemInfo removeFront() {
        ItemInfo result = null;
        if (head != null) {
            size--;
            result = head.info;
            if (head.next != null) {
                head.next.prev = null;
                head = head.next;
            } else {
                head = null;
                tail = null;
            }
        }
        return result;
    }

    public class ItemInfoNode {

        private ItemInfoNode next;
        private ItemInfoNode prev;
        private ItemInfo info;

        public ItemInfoNode(ItemInfo info, ItemInfoNode next, ItemInfoNode prev) {
            this.info = info;
            this.next = next;
            this.prev = prev;
        }

        public void setInfo(ItemInfo info) {
            this.info = info;
        }

        public void setNext(ItemInfoNode node) {
            next = node;
        }

        public void setPrev(ItemInfoNode node) {
            prev = node;
        }

        public ItemInfo getInfo() {
            return info;
        }

        public ItemInfoNode getNext() {
            return next;
        }

        public ItemInfoNode getPrev() {
            return prev;
        }
    }
}

EDIT:

Declare ItemInfo as this:

public class ItemInfo {
    private String name;
    private String rfdNumber;
    private double price;
    private String originalPosition;

    public ItemInfo(){
    }

    public ItemInfo(String name, String rfdNumber, double price, String originalPosition) {
        this.name = name;
        this.rfdNumber = rfdNumber;
        this.price = price;
        this.originalPosition = originalPosition;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getRfdNumber() {
        return rfdNumber;
    }

    public void setRfdNumber(String rfdNumber) {
        this.rfdNumber = rfdNumber;
    }

    public double getPrice() {
        return price;
    }

    public void setPrice(double price) {
        this.price = price;
    }

    public String getOriginalPosition() {
        return originalPosition;
    }

    public void setOriginalPosition(String originalPosition) {
        this.originalPosition = originalPosition;
    }
}

Then, You can use your nodes inside the linked list like this:

public static void main(String[] args) {
    ItemLinkedList list = new ItemLinkedList();
    for (int i = 1; i <= 10; i++) {
        list.addBack(new ItemInfo("name-"+i, "rfd"+i, i, String.valueOf(i)));

    }
    while (list.size() > 0){
        System.out.println(list.removeFront().getName());
    }
}