Shortest Path Java Code
Hi
I have created a topological network in Oracle Spatial and now
I am trying to find the shortest path between two nodes.
Is there a sample java code (or instructions) that connects to the database
and gets that information?
Thank u
Oracle Spatial NDM Java API has several shortest path analysis functions. A simple example is as follows.
// establish JDBC connection: you need specify dbURL, user1, password1
OracleDataSource ods1 = new OracleDataSource();
ods1.setURL(dbURL);
ods1.setUser(user1);
ods1.setPassword(password1);
Connection conn1 = ods1.getConnection();
// read in network, netName is the name of your network in the database
Network net = NetworkManager.readNetwork(conn1, netName);
// perform shortestPath analysis
Path path = NetworkManager.shortestPath(net, startNodeID, endNodeID);
// then from Path interface, you can access its constituent link/node information
}
Similar Messages
-
How to specify a file path in java code to run on Unix machine?
Hi
I have a problem when running my project Swing on Unix machine.
In my code, the user will press a button and then the program will look for the file "ReadMe" in the folder "Documentation" , and reads the content of this file. My code is "Documentation\\ReadMe" and it works well on PC. (The folder "Documentation" is in the same directory with my Java code).
But when I try on Unix, the program can not read the file. It can only read the file "ReadMe" if I take this file and put it in the same directory with my Java code ( this means not through another folder). So how can we make it read the file in a folder ? It seems that "Documentation\\ReadMe" does not work in Unix, or the symbol "\\" does not work.
I would be thankful if anybody can help me with this.
Thank you very muchYou really shouldn't use any path method, as neither are very consistant or platform independent. The JVM provides a way to grab resources from the classpath. These resources can be any data at all, in fact, it's how java itself locates classes. Here's an example how you would do this in a non-static method.
public URL getReadMe() {
// In this context the forward slash is universal
String docDirectory = "Documentation/"
// We have to use the classloader to grab the resource
ClassLoader cl = this.getClass().getClassLoader();
// Next we get the resource
URL readMeURL = cl.getResource(docDirectory + "ReadMe");
return readMeURL;
}The URL can be used in whatever way you need to get the information out of the resource. If it was an image you might use the "Toolkit" to make an image object out of it. The great thing about this method is it will work even if your loading the program out of a Jar file. The resource paths start at the top of the classpath, just like classes. -
Setting java.library.path property in java code
Hi,
i'd like to set java.library.path property in java code to load a dll-library. I know that a funtional way is to run JVM with parameter -Djava.library.path=c:\tmp, but I need it do it IN CODE.
I'v tried this:
System.setProperty("java.library.path", "c:\\tmp");
System.loadLibrary("libapr");The library 'libapr.dll' is situated really in 'c:\tmp' directory, but I get 'java.lang.UnsatisfiedLinkError: no libapr in java.library.path' exception.
It seems like the already running java program doesn't use actual java.library.path set in previous step.
Is there any possibility to set java.library.path property in java code?
Thanx
BrnyI think the following code should work:
// Reset the "sys_paths" field of the ClassLoader to null.
Class clazz = ClassLoader.class;
Field field = clazz.getDeclaredField("sys_paths");
boolean accessible = field.isAccessible();
if (!accessible)
field.setAccessible(true);
Object original = field.get(clazz);
// Reset it to null so that whenever "System.loadLibrary" is called, it will be reconstructed with the changed value.
field.set(clazz, null);
try {
// Change the value and load the library.
System.setProperty("java.library.path", "c:\\tmp");
System.loadLibrary("libapr");
finally {
//Revert back the changes.
field.set(clazz, original);
field.setAccessible(accessible);
The idea is to make the static field "sys_paths" null so that it would construct the paths from the changed value. -
How to get component path in java code
Hi everybody,
I have my custom component with custom folders with pictures. My custom component works with pictures. I need to know PATH to this custom component in my java code.
Thank you
MartinCheck out methods in the following classes: LegacyDirectoryLocator and DirectoryLocator.
Jonathan
http://jonathanhult.com -
hi
if nyone cud give me the code for finding the shortest path between 2 points but in this case all the paths have equal weights i.e. the shortest path would be the involvement of minimum number of nodes between the start & the end node.
Please am stuck up if anyone can provide me with the code.
Thanks in advanceRelated to Dijkstra's shortest path algorithm if all edges have equal
weight, just the heap management (priority queue) will be much simpler.
If the graph to be traversed isn't too big, a simple linear array could do the
job fine where entry i indexes paths of length i. Nothing much else is to
be gained though: it stil will be a permanent graph labeling algoritm.
kind regards,
Jos -
OpenScript/How to add .jar file to Java Code in relative path
Hi all,
I want to add a .jar file which can be executed separately (like "java -jar A.jar") to my recorded Java Code.I've read this wiki http://everest2.us.oracle.com/wiki/Generic_JAR_Project about how to add a .jar file to "Assets", however, I cannot figure out how to use the .jarr file in Java code,I mean , how to get this .jar file like the method the databank added in "Assets"?
Things I did are as followed:
1.Execute my .jar file in OpenScript Java code with absolute path like this:
String cmd = "C:\Users\A.jar";
Runtime.getRuntime().exec(cmd);
This does work, but must set a absolute path in Java code like "C:\User\A.jar" ,which is not the workaround I want (I need my scripts can be run on other machines).
2.Try to get its current path with following codes:
File directory = new File(".");
String currentPath=directory.getCanonicalPath();
However,though this can get its absolute path (which is the the project path) in Eclipse like "C:\Users\Workspace\testProject", this only gets "C:\OracleATS\openScript" in OpenScript.
I thought to copy my .jar file to the project path , got its current path in java code first,then can know the path of .jar file, but this workaround failed because of the above reason.
I notice that in the "Assets" there are "Databanks","Object Libraries","JAR Files","Scripts". Since the databanks and scripts that added to "Databanks" and "Scripts" can be got or run in Java Code like:
*getDatabank("DatabankName").getNextDatabankRecord(); String data = eval("{{db.DatabankName.data}}");*
*or getScript("ScriptName").run();*
*Is there a method to get and run the jar file added to "Assets\JAR Files" like the above?*
Thank you very much!
Regards,
AngyoungHi DM,
Thanks for your reply!
I've found a workaround,which is calling OpenScript's APIs ,such as this.getScriptPackage().getRepository() and this.getScriptPackage().getWorkspace(),etc to locate the .jar file.
And this workaround can still work even though the script is run on other machine.
Sorry to reply you so late!
Regards,
Angyoung -
Hi all,
I have created spatial network containing non lrs sdo_geometry objects in Oracle 10g (Release 2). In this network model there are 33208 nodes and 42406 links.
Now I need to write a java program to find shortest route between two selected nodes. Here is snippet of my source code.
Connection connection = DriverManager.getConnection(dbUrl, databaseUser, databasePassword);
boolean readForUpdate = false;
Network net= NetworkManager.readNetwork(connection, "SDO_ROAD_NETWORK", readForUpdate);
Path path = NetworkManager.shortestPath(net, startNodeId ,endNodeId);
System.out.println ("total distance " path.getCost() );+
Link[] linkArray = path.getLinkArray();
But this will throws an exception - Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
It was working fine for 1000 nodes and 1000 links. I tried by changing java options like -Xms and Xmx parameters but same result.
Then I tried to find shortest route using pl/sql using following.
DECLARE
testNet VARCHAR2(30) := 'SDO_ROAD_NETWORK';
startNode NUMBER := 120150;
endNode NUMBER :=1740034;
path NUMBER;
linkArray SDO_NUMBER_ARRAY;
BEGIN
sdo_net_mem.network_manager.read_network('SDO_ROAD_NETWORK', 'FALSE');
dbms_output.put_line('Loading finished');
path := SDO_NET_MEM.NETWORK_MANAGER.SHORTEST_PATH_DIJKSTRA('SDO_ROAD_NETWORK', startNode, endNode);
IF path IS NULL THEN
dbms_output.put_line('route not found');
return;
END IF;
linkArray := SDO_NET_MEM.PATH.GET_LINK_IDS(testNet, path);
FOR i IN linkArray.first..linkArray.last
LOOP
dbms_output.put_line('Link -- ' || linkArray(i) || ' ' ||
SDO_NET_MEM.LINK.GET_NAME (testNet, linkArray(i)) || ' ' ||
SDO_NET_MEM.LINK.GET_COST (testNet, linkArray(i)));
END LOOP;
END;
+/+
But this takes nearly 4 minutes to just read the nework (sdo_net_mem.network_manager.read_network).
Finally I dowloaded standalone java client application NDM Network Editor from OTN. This application loads entire network within 25 seconds and finds shortest route within 5 seconds.
Please guide me how can I write improved code reading network. My requirement is to get shortest path between two nodes
Thanks,
SujnanHi Sujnan
In the past there have been some performance issue for the Oracle JVM. Not sure if this addressed in the latest releases (10.r2 or 11).
Performance Status OJVM used for SDO Network data Model 10R2.0.2
Maybe the oracle guys can give an update.
Luc -
Hey guys, first...Happy thanksgiving :)
Ok, so I'm on my last assignment for my amazingly taught Data Structures class. I battled my way successfully through recursion, binary trees, redblack trees, 234 trees, B Trees, and heaps!...no issues at all!....but, now I have hit graphs. I understand the concept, but my latest assignment has me a bit frustrated..Im so close to finishing I can taste it!!....I just cant find the spoon..
Here we go:
We are given a graph on paper. It has circles (verteci) representing cities in the USA. These circles are connected by lines (edges) representing the distance between the cities. Also, the lines have arrows pointing the direction they may be traversed.
We are to construct the graph in the computer, and then compute the shortest path from washington (Vertex 0) to every other city.
I managed to construct the graph, and it will find the shortest path no problem. My only issue is that, it wants us to print the path it took, not just the destination and total distance....
I have tried using a stack to push the verteci onto as theyre visited, but im not getting happy results.
I should also mention, this code is taken out of the book with modifications by me so that it can add edges and verteci, and it now accepts String types for the vertex labels instead of characters.
Here is my code
PATH.JAVA (the important part)
// path.java
// demonstrates shortest path with weighted, directed graphs
// to run this program: C>java PathApp
import java.lang.*;
import java.io.*;
class DistPar // distance and parent
{ // items stored in sPath array
public int distance; // distance from start to this vertex
public int parentVert; // current parent of this vertex
public DistPar(int pv, int d) // constructor
distance = d;
parentVert = pv;
} // end class DistPar
class Vertex
public String label; // label (e.g. 'A')
public boolean isInTree;
public Vertex(String lab) // constructor
label = lab;
isInTree = false;
} // end class Vertex
class Graph
private final int MAX_VERTS = 20;
private final int INFINITY = 1000000;
private Vertex vertexList[]; // list of vertices
private int adjMat[][]; // adjacency matrix
private int nVerts; // current number of vertices
private int nTree; // number of verts in tree
private DistPar sPath[]; // array for shortest-path data
private int currentVert; // current vertex
private int startToCurrent; // distance to currentVert
private stack path_taken; // stack to record path taken
public Graph() // constructor
vertexList = new Vertex[MAX_VERTS];
// adjacency matrix
adjMat = new int[MAX_VERTS][MAX_VERTS];
nVerts = 0;
nTree = 0;
for(int j=0; j<MAX_VERTS; j++) // set adjacency
for(int k=0; k<MAX_VERTS; k++) // matrix
adjMat[j][k] = INFINITY; // to infinity
sPath = new DistPar[MAX_VERTS]; // shortest paths
path_taken = new stack(MAX_VERTS);
} // end constructor
public void addVertex(String lab)
vertexList[nVerts++] = new Vertex(lab);
public void addEdge(int start, int end, int weight)
adjMat[start][end] = weight; // (directed)
public void path() // find all shortest paths
int startTree = 0; // start at vertex 0
vertexList[startTree].isInTree = true;
nTree = 1; // put it in tree
// transfer row of distances from adjMat to sPath
for(int j=0; j<nVerts; j++)
int tempDist = adjMat[startTree][j];
sPath[j] = new DistPar(startTree, tempDist);
// until all vertices are in the tree
while(nTree < nVerts)
int indexMin = getMin(); // get minimum from sPath
int minDist = sPath[indexMin].distance;
if(minDist == INFINITY) // if all infinite
{ // or in tree,
System.out.println("There are unreachable vertices");
break; // sPath is complete
else
{ // reset currentVert
currentVert = indexMin; // to closest vert
startToCurrent = sPath[indexMin].distance;
// minimum distance from startTree is
// to currentVert, and is startToCurrent
// put current vertex in tree
vertexList[currentVert].isInTree = true;
nTree++;
path_taken.push(sPath[indexMin]);
adjust_sPath(); // update sPath[] array
} // end while(nTree<nVerts)
displayPaths(); // display sPath[] contents
nTree = 0; // clear tree
for(int j=0; j<nVerts; j++)
vertexList[j].isInTree = false;
} // end path()
public int getMin() // get entry from sPath
{ // with minimum distance
int minDist = INFINITY; // assume minimum
int indexMin = 0;
for(int j=1; j<nVerts; j++) // for each vertex,
{ // if it's in tree and
if( !vertexList[j].isInTree && // smaller than old one
sPath[j].distance < minDist )
minDist = sPath[j].distance;
indexMin = j; // update minimum
} // end for
return indexMin; // return index of minimum
} // end getMin()
public void adjust_sPath()
// adjust values in shortest-path array sPath
int column = 1; // skip starting vertex
while(column < nVerts) // go across columns
// if this column's vertex already in tree, skip it
if( vertexList[column].isInTree )
column++;
continue;
// calculate distance for one sPath entry
// get edge from currentVert to column
int currentToFringe = adjMat[currentVert][column];
// add distance from start
int startToFringe = startToCurrent + currentToFringe;
// get distance of current sPath entry
int sPathDist = sPath[column].distance;
// compare distance from start with sPath entry
if(startToFringe < sPathDist) // if shorter,
{ // update sPath
sPath[column].parentVert = currentVert;
sPath[column].distance = startToFringe;
column++;
} // end while(column < nVerts)
} // end adjust_sPath()
public void displayPaths()
for(int j=0; j<nVerts; j++) // display contents of sPath[]
System.out.print(vertexList[j].label + "="); // B=
if(sPath[j].distance == INFINITY)
System.out.print("inf"); // inf
else
System.out.print(sPath[j].distance); // 50
String parent = vertexList[ sPath[j].parentVert ].label;
System.out.print(" (" + parent + ") "); // (A)
System.out.println("");
System.out.println("PRINTING path_taken");
DistPar thing = null;
while((thing = path_taken.pop()) != null)
System.out.println(" " + vertexList[thing.parentVert].label + " "+ thing.distance);
} // end class GraphSTACK.JAVA (my stack class)
// stack.java
// demonstrates stacks
// to run this program: C>java StackApp
class stack
private int maxSize; // size of stack array
private DistPar[] stackArray;
private int top; // top of stack
public stack(int s) // constructor
maxSize = s; // set array size
stackArray = new DistPar[maxSize]; // create array
top = -1; // no items yet
public void push(DistPar j) // put item on top of stack
stackArray[++top] = j; // increment top, insert item
public DistPar pop() // take item from top of stack
return stackArray[top--]; // access item, decrement top
public DistPar peek() // peek at top of stack
return stackArray[top];
public boolean isEmpty() // true if stack is empty
return (top == -1);
public boolean isFull() // true if stack is full
return (top == maxSize-1);
}PATHAPP.JAVA (test program..builds the graph and calls path())
class PathApp
public static void main(String[] args)
Graph theGraph = new Graph();
theGraph.addVertex("Washington");
theGraph.addVertex("Atlanta");
theGraph.addVertex("Houston");
theGraph.addVertex("Denver");
theGraph.addVertex("Dallas");
theGraph.addVertex("Chicago");
theGraph.addVertex("Austin");
theGraph.addEdge(0,1,600);
theGraph.addEdge(1,0,600);
theGraph.addEdge(0,4,1300);
theGraph.addEdge(4,3,780);
theGraph.addEdge(3,1,1400);
theGraph.addEdge(1,2,800);
theGraph.addEdge(2,1,800);
theGraph.addEdge(4,5,900);
theGraph.addEdge(4,6,200);
theGraph.addEdge(6,4,200);
theGraph.addEdge(6,2,160);
theGraph.addEdge(3,5,1000);
theGraph.addEdge(5,3,1000);
System.out.println("Shortest Paths");
theGraph.path();
//theGraph.displayPaths();
System.out.println();
}Im mostly having trouble comprehending the Path.java file. A few friends and I stared at it for a few hours and couldnt get it to do what we wanted...
path_taken is the stack I added in to try and push/pop the verteci as theyre traversed, but with what I stuck in right now, it still just prints the most recently visited vertex, and the sum of the distances.
Any help is greatly appreciated!
Thanks :)
----ArkhanIf your graph is G(V, E), and you're trying to get to vertex v_end, then create a new graph G'(V', E') whereV' = (V x N) U {v_end'}
(v_end' is a new object)
E' = {((u, t), (v, t + f(u, v, t))) : (u, v) in E, t in N} U
{((u, t), (u, t + 1)) : u in V, t in N} U
{((v_end, t), v_end') : t in N}G' is infinite, so you'll need to use a lazy graph structure. Then just use Dijkstra from (v_start, 0) to v_end'. -
Hi all.
I found some open source code which implements the A Star algorithm to achieve path finding for the purpose of navigating something in a game (although it could really be used for anything). Problem is, I can't get it to work. I've e-mailed the author but no reply yet so I was hoping someone could shed some light on my situation.
The code is meant to find a path on a 2 dimensional grid filled with obstacles using the following methods:
PathFinder star = new PathFinder(grid);
Path p = star.findShortest(startRow,startCol,goalRow,goalCol);
I've made a simple Test class with a small 2D array but when I compile the code I recieve the error:
Incompatible types.
Found: int.
Required: Test.Path
on Path p = star.findShortest(1,1,2,2);
I don't understand this error at all. The findShortest method takes 4 integers and I'm passing it 4 integers! Any ideas what this error means?
Here's my Test class:
import java.util.*;
import javax.swing.plaf.basic.*;
import java.awt.event.*;
import javax.swing.*;
import java.io.*;
import javax.swing.filechooser.*;
import java.util.Random;
public class Test
public static void main(String args[])
Test test = new Test();
test.run();
public final static class Path
/** 2 for down, 0 is up, 1 is right and 3 is left */
public int giveMove() {
if (size() < 2)
return -1;
Position last = (Position)positions.get(size() - 1);
Position forlast = (Position)positions.get(size() - 2);
if (forlast.col - last.col == 1)
return 2; //down
else if (forlast.col - last.col == -1)
return 0; //up
else if (forlast.row - last.row == 1)
return 1;//right
else if (forlast.row - last.row == -1)
return 3; //left
return -1;
/** list of positions */
public List positions;
public int getCost() { return positions.size() - 1; }
public int size() { return positions.size(); }
public void add(Object o) { positions.add(o); }
/** add (r,c) to the path */
public void add(int r, int c) {
positions.add(new Position(r,c));
/** get first position */
public Position head() { return (Position) positions.get(0); }
public Path(ArrayList positions) { this.positions = positions; }
public Path(Position initial) {
positions = new ArrayList(1);
positions.add(initial);
public Path(int cap) { positions = new ArrayList(cap); }
public void set(Position front, Path old) {
positions.add(front);
Iterator i = old.positions.iterator();
while (i.hasNext())
positions.add(i.next());
/** position on the grid */
public static final class Position
public int row, col;
public Position(int row, int col) {
this.row = row; this.col = col;
public void run()
System.out.println("Test");
PathFinder star = new PathFinder(grid);
for(int counter = 0; counter < grid.length; counter++)
for (int j=0; j < grid[counter].length; j++)
grid[counter][j] = 0;
Path p = star.findShortest(1, 1, 2, 2);
private static int[][] grid = new int[2][2];
} Here's the PathFinder class I downloaded:
import java.util.*;
import javax.swing.plaf.basic.*;
import java.awt.event.*;
import javax.swing.*;
import java.io.*;
import javax.swing.filechooser.*;
import java.util.Random;
public final class PathFinder {
/** the map grid to look on */
private final int [][] grid;
/** keep distances to each position here */
private final int [][] distances;
/** is gridposition (r, c) empty (empty is -1) ? */
private boolean isEmpty(int r, int c) {
return grid[r][c] == -1 ;
/** pathfinder for grid */
public PathFinder(int[][] grid) {
this.grid = grid;
this.distances = new int [grid.length][grid.length];
/** clear distances */
private void clear() {
for (int i = 0 ; i < distances.length ; i++)
for (int j = 0 ; j < distances.length ; j++)
distances[i][j] = Integer.MAX_VALUE;
/** position on the grid */
public final static class Position {
public int row, col;
public Position(int row, int col) {
this.row = row; this.col = col;
/** path from start to a certain position */
public final static class Path {
/** 2 for down, 0 is up, 1 is right and 3 is left */
public int giveMove() {
if (size() < 2)
return -1;
Position last = (Position)positions.get(size() - 1);
Position forlast = (Position)positions.get(size() - 2);
if (forlast.col - last.col == 1)
return 2; //down
else if (forlast.col - last.col == -1)
return 0; //up
else if (forlast.row - last.row == 1)
return 1;//right
else if (forlast.row - last.row == -1)
return 3; //left
return -1;
/** list of positions */
public List positions;
public int getCost() { return positions.size() - 1; }
public int size() { return positions.size(); }
public void add(Object o) { positions.add(o); }
/** add (r,c) to the path */
public void add(int r, int c) {
positions.add(new Position(r,c));
/** get first position */
public Position head() { return (Position) positions.get(0); }
public Path(ArrayList positions) { this.positions = positions; }
public Path(Position initial) {
positions = new ArrayList(1);
positions.add(initial);
public Path(int cap) { positions = new ArrayList(cap); }
public void set(Position front, Path old) {
positions.add(front);
Iterator i = old.positions.iterator();
while (i.hasNext())
positions.add(i.next());
/** gives the move to take for the shortest path from startRow to startCol
* 0 up, 1 right, 2 down, 3 left
* -1 if no move possible
public final int findShortest
(int startRow, int startCol, int goalRow, int goalCol) {
clear();
Position initial = new Position(startRow, startCol);
//LinkedList list = new LinkedList();
Position goal = new Position(goalRow, goalCol);
BinaireHoop list = new BinaireHoop(200, new Path(goal), goal);
list.add(new Path(initial));
Position [] successors = new Position[4];
int trie = 0;
for ( ; ! list.isEmpty() && trie < 10000 ; trie++) {
Path first = (Path) list.remove();
Position firstPos = first.head();
int r = firstPos.row; int c = firstPos.col;
if (r == goalRow && c == goalCol) { //goal found !
return first.giveMove();
} else {
int successorsCount = 0;
if (isEmpty(r-1,c)) {
successors[successorsCount++]
= new Position(r-1, c);
if (isEmpty(r+1,c)) {
successors[successorsCount++]
= new Position(r+1, c);
if (isEmpty(r,c-1)) {
successors[successorsCount++]
= new Position(r, c-1);
if (isEmpty(r,c+1)) {
successors[successorsCount++]
= new Position(r, c+1);
while (successorsCount-- > 0) {
Position succ = successors[successorsCount];
int newPathCost = first.getCost() + 1;
//add newPath if shorter than other path to this position
if (distances[succ.row][succ.col] > newPathCost) { //shorter
distances[succ.row][succ.col] = newPathCost;
Path newPath = new Path(newPathCost + 1);
newPath.set(succ, first);
//add path to binary heap
list.add(newPath);
} // else longer: discard
return -1;
There's also a BinaireHoop class which the PathFinder class uses. I'll post that code if anyone thinks it's relevant but the error appears to be soley on my implementation. The Path and Position and just small subclass which for the sake of quickness I just placed into my Test class too instead of into a new class to themselves.
Any thoughts appreciated! I would really like to get this working =)
Thanks.Thanks for your reply. Doh, totally missed that one =)
Anyway, I got the code working but it's still very buggy. I think this must just be a problem with the PathFinder class I downloaded.
I create a 2D array
int[][] array = {
{-1, -1, -1, -1, -1, -1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1}
};and choose starting and goal coordinates
int p = star.findShortest(1, 1, 2, 2);The PathFinder will generate the coordinates to move to (I just stuck it all in a loop and updated the starting coordinates as appropriate to lead me to the goal). This is great!
However, there seem to be a lot of bugs when I introduce "occupied squares". Basically, -1 in the array means that that square is empty whereas anything else means its full and the path finder should, in theory, generate a path around these obstacles. This isn't working correctly though.
Sometimes a path wil be found around the obstacle, sometimes the path will go straight through it, and many times it just throws an array index out of bounds exception error!
Anyone got any ideas? Or does anyone have any examples of a working path finder? =)
Cheers -
Shortest path between two arbitrary point in the network
Hi All,
In oracle NDM, it's possible to find shortest path between two nodes (e.g. using SDO_NET_MEM.NETWORK_MANAGER.SHORTEST_PATH), but I need to find shortest path between 2 points which are on the network edges. I suppose I should use (Interface SubPath) in network java apis. However I want to do it via PLSQL api. Should I code it myself or there exists a function?
Any help is appreciated.
Edited by: Fa on Dec 15, 2011 2:51 AMpritamg wrote:
I have to build an application in which the user will draw the graph by creating nodes and edges.and then the start node will be marked.Then the shortest paths to other nodes will be displayed.Give me any possible clue how to start.I am in deep deep trouble.I have to use Dijkstra's Algorithm.
please help some one...pleaseDo you know Dijkstra's Algorithm for shortest path? I believe that one was also called the traveling salesman problem. You can easily Google to find out what it is.
Did you listen to your instructor when he/she did his/her lectures on recursion and halting contitions? If not, then please go talk to him/her and read your book, the forum is not a place to try to learn a basic concept that you should have paid attention in class for the first time.
If you have code and you have specific questions post them and we will be glad to help, but we are not here to develop your homework solutions for you, no matter how that may affect your future. -
EXCEPTION_ACCESS_VIOLATION (0xc0000005) on compiled Java code
I'm confronted with the following error of this code.
http://db-www.naist.jp/~makoto-y/tmp/Int2LongHash.java
The exception appears only when the system gets high-load.
Is there work-arounds?
I've tried also with jdk1.5.0_06, but the same error occurred.
Converting the inner class to a top-level class has no effects.
# An unexpected error has been detected by Java Runtime Environment:
# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x00a2cd75, pid=1540, tid=2968
# Java VM: Java HotSpot(TM) Client VM (1.6.0-beta2-b86 mixed mode)
# Problematic frame:
# J org.metabrick.xbird.util.collections.Int2LongHash$Int2LongLRUMap$ChainedEntry.recordRemoval(Lorg/metabrick/xbird/util/collections/Int2LongHash;)V
# If you would like to submit a bug report, please visit:
# http://java.sun.com/webapps/bugreport/crash.jsp
--------------- T H R E A D ---------------
Current thread (0x003f6800): JavaThread "main" [_thread_in_Java, id=2968]
siginfo: ExceptionCode=0xc0000005, writing address 0xfc2cee54
Registers:
EAX=0x42d43500, EBX=0x03d3ee00, ECX=0x03d3ee00, EDX=0x07911838
ESP=0x0091f760, EBP=0x0091f778, ESI=0x0790f9f8, EDI=0xfc2cee38
EIP=0x00a2cd75, EFLAGS=0x00010203
Top of Stack: (sp=0x0091f760)
0x0091f760: 0790ac30 079220b0 00000200 03d917f8
0x0091f770: 00000000 6d955aa7 0091f7a8 00a2c9dc
0x0091f780: 00000200 00000000 0091f7e8 00a12d50
0x0091f790: 5ab674cf 00000000 07911838 03d3ee00
0x0091f7a0: 03d8b700 00000010 0091f7f8 00a2c000
0x0091f7b0: 03d8b700 078e4af4 00000010 00a2ab04
0x0091f7c0: 078e4af4 03d8b700 00000010 00000001
0x0091f7d0: 00000000 6d955ae7 5ab674d0 00000000
Instructions: (pc=0x00a2cd75)
0x00a2cd65: 20 8b fe c1 ef 09 c6 87 80 b1 5b 48 00 8b 79 20
0x00a2cd75: 89 77 1c c1 ef 09 c6 87 80 b1 5b 48 00 8b e5 5d
Stack: [0x008d0000,0x00920000), sp=0x0091f760, free space=317k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
J org.metabrick.xbird.util.collections.Int2LongHash$Int2LongLRUMap$ChainedEntry.recordRemoval(Lorg/metabrick/xbird/util/collections/Int2LongHash;)V
J org.metabrick.xbird.util.collections.Int2LongHash.remove(I)J
J org.metabrick.xbird.util.collections.Int2LongHash$Int2LongLRUMap.addEntry(IIJLorg/metabrick/xbird/util/collections/Int2LongHash$BucketEntry;)V
J org.metabrick.xbird.util.collections.Int2LongHash.put(IJ)J
J org.metabrick.xbird.xquery.util.StringChunk.storeCharChunk([CII)J
J org.metabrick.xbird.xquery.util.StringChunk.store([CII)J
J org.metabrick.xbird.xquery.dm.dtm.BigDocumentTable.setTextAt(J[CII)J
J org.metabrick.xbird.xquery.dm.dtm.DocumentTableBuilder.createTextNode()V
J org.metabrick.xbird.xquery.dm.dtm.DocumentTableBuilder.endElement(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
J org.apache.xerces.parsers.AbstractSAXParser.endElement(Lorg/apache/xerces/xni/QName;Lorg/apache/xerces/xni/Augmentations;)V
J org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanEndElement()I
J org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Z)Z
j org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Z)Z+24
j org.apache.xerces.parsers.XML11Configuration.parse(Z)Z+132
j org.apache.xerces.parsers.XML11Configuration.parse(Lorg/apache/xerces/xni/parser/XMLInputSource;)V+29
j org.apache.xerces.parsers.XMLParser.parse(Lorg/apache/xerces/xni/parser/XMLInputSource;)V+9
j org.apache.xerces.parsers.AbstractSAXParser.parse(Lorg/xml/sax/InputSource;)V+43
j org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Lorg/xml/sax/InputSource;)V+43
j org.metabrick.xbird.xquery.dm.instance.DocumentTableModel.loadDocument(Ljava/io/InputStream;)V+35
j org.metabrick.xbird.client.tools.command.ImportDocument.process([Ljava/lang/String;)Z+99
j org.metabrick.xbird.client.tools.CommandInvoker.executeCommand([Ljava/lang/String;)Z+8
j org.metabrick.xbird.client.tools.CommandInvoker.run([Ljava/lang/String;)V+66
j org.metabrick.xbird.client.tools.CommandInvoker.main([Ljava/lang/String;)V+19
v ~StubRoutines::call_stub
--------------- P R O C E S S ---------------
Java Threads: ( => current thread )
0x48aa5000 JavaThread "Low Memory Detector" daemon [_thread_blocked, id=3636]
0x48aa0800 JavaThread "CompilerThread0" daemon [_thread_blocked, id=4076]
0x48a9e400 JavaThread "Attach Listener" daemon [_thread_blocked, id=3144]
0x48aac400 JavaThread "Signal Dispatcher" daemon [_thread_blocked, id=2248]
0x48a86c00 JavaThread "Finalizer" daemon [_thread_blocked, id=2664]
0x48a82800 JavaThread "Reference Handler" daemon [_thread_blocked, id=2700]
=>0x003f6800 JavaThread "main" [_thread_in_Java, id=2968]
Other Threads:
0x48a7f400 VMThread [id=4028]
0x48aa6800 WatcherThread [id=3704]
VM state:not at safepoint (normal execution)
VM Mutex/Monitor currently owned by a thread: None
Heap
def new generation total 72576K, used 28616K [0x029d0000, 0x07890000, 0x07890000)
eden space 64512K, 32% used [0x029d0000, 0x03e6fdd0, 0x068d0000)
from space 8064K, 92% used [0x068d0000, 0x07022230, 0x070b0000)
to space 8064K, 0% used [0x070b0000, 0x070b0000, 0x07890000)
tenured generation total 967936K, used 253073K [0x07890000, 0x429d0000, 0x429d0000)
the space 967936K, 26% used [0x07890000, 0x16fb4788, 0x16fb4800, 0x429d0000)
compacting perm gen total 12288K, used 5879K [0x429d0000, 0x435d0000, 0x469d0000)
the space 12288K, 47% used [0x429d0000, 0x42f8dd08, 0x42f8de00, 0x435d0000)
No shared spaces configured.
Dynamic libraries:
0x00400000 - 0x00423000 C:\Program Files\Java\jdk1.6.0\bin\javaw.exe
0x7c940000 - 0x7c9dd000 C:\WINDOWS\system32\ntdll.dll
0x7c800000 - 0x7c931000 C:\WINDOWS\system32\kernel32.dll
0x77d80000 - 0x77e29000 C:\WINDOWS\system32\ADVAPI32.dll
0x77e30000 - 0x77ec1000 C:\WINDOWS\system32\RPCRT4.dll
0x77cf0000 - 0x77d7f000 C:\WINDOWS\system32\USER32.dll
0x77ed0000 - 0x77f17000 C:\WINDOWS\system32\GDI32.dll
0x762e0000 - 0x762fd000 C:\WINDOWS\system32\IMM32.DLL
0x60740000 - 0x60749000 C:\WINDOWS\system32\LPK.DLL
0x73f80000 - 0x73feb000 C:\WINDOWS\system32\USP10.dll
0x77bc0000 - 0x77c18000 C:\WINDOWS\system32\msvcrt.dll
0x7c340000 - 0x7c396000 C:\Program Files\Java\jdk1.6.0\jre\bin\msvcr71.dll
0x6d7f0000 - 0x6da2f000 C:\Program Files\Java\jdk1.6.0\jre\bin\client\jvm.dll
0x76af0000 - 0x76b1b000 C:\WINDOWS\system32\WINMM.dll
0x6d310000 - 0x6d318000 C:\Program Files\Java\jdk1.6.0\jre\bin\hpi.dll
0x76ba0000 - 0x76bab000 C:\WINDOWS\system32\PSAPI.DLL
0x6d7a0000 - 0x6d7ac000 C:\Program Files\Java\jdk1.6.0\jre\bin\verify.dll
0x6d3a0000 - 0x6d3bf000 C:\Program Files\Java\jdk1.6.0\jre\bin\java.dll
0x6d7e0000 - 0x6d7ef000 C:\Program Files\Java\jdk1.6.0\jre\bin\zip.dll
0x6d560000 - 0x6d573000 C:\Program Files\Java\jdk1.6.0\jre\bin\net.dll
0x719e0000 - 0x719f7000 C:\WINDOWS\system32\WS2_32.dll
0x719d0000 - 0x719d8000 C:\WINDOWS\system32\WS2HELP.dll
0x6d580000 - 0x6d589000 C:\Program Files\Java\jdk1.6.0\jre\bin\nio.dll
VM Arguments:
jvm_args: -Xmx1024m -Xms1024m
java_command: org.metabrick.xbird.client.tools.CommandInvoker -col /xmark import document C:\Software\xmark\xmark100.xml
Launcher Type: SUN_STANDARD
Environment Variables:
JAVA_HOME=C:\Program Files\Java\jdk1.6.0
PATH=C:\Program Files\Java\jdk1.6.0\bin;D:\Software\maven-1.0.2\bin;D:\cygwin\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;D:\Software\apache-ant-1.6.5\bin;C:\ghc\ghc-6.4.2\bin;C:\Program Files\QuickTime\QTSystem\
USERNAME=yui
OS=Windows_NT
PROCESSOR_IDENTIFIER=x86 Family 15 Model 4 Stepping 4, GenuineIntel
--------------- S Y S T E M ---------------
OS: Windows XP Build 2600 Service Pack 2
CPU:total 2 family 15, cmov, cx8, fxsr, mmx, sse, sse2, ht
Memory: 4k page, physical 2096404k(108924k free), swap 3511144k(1471688k free)
vm_info: Java HotSpot(TM) Client VM (1.6.0-beta2-b86) for windows-x86, built on Jun 2 2006 00:36:31 by "java_re" with unknown MS VC++:1310The following is the error that I got with using JDK 1.5.
# An unexpected error has been detected by HotSpot Virtual Machine:
# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x00b8c9f8, pid=4024, tid=1608
# Java VM: Java HotSpot(TM) Client VM (1.5.0_06-b05 mixed mode)
# Problematic frame:
# J org.metabrick.xbird.util.collections.Int2LongHash$Int2LongLRUMap$ChainedEntry.recordRemoval(Lorg/metabrick/xbird/util/collections/Int2LongHash;)V
--------------- T H R E A D ---------------
Current thread (0x00036190): JavaThread "main" [_thread_in_Java, id=1608]
siginfo: ExceptionCode=0xc0000005, writing address 0xfa424094
Registers:
EAX=0x00040e40, EBX=0xfa424078, ECX=0x05bd3fc0, EDX=0x05bd3fc0
ESP=0x0007f578, EBP=0x0007f590, ESI=0xfa424078, EDI=0x081c8168
EIP=0x00b8c9f8, EFLAGS=0x00010203
Top of Stack: (sp=0x0007f578)
0x0007f578: 081c1fa8 6d7d1061 022dd1c8 00000000
0x0007f588: 00000200 00000200 0007f5c8 00b8c598
0x0007f598: 0899f428 05bd3fc0 00000200 00000000
0x0007f5a8: 0007f5c8 00b41018 00000200 000001cb
0x0007f5b8: 05c50338 05c19448 05bd3fc0 000001a8
0x0007f5c8: 0007f648 00b8b880 07dd565c 0899f428
0x0007f5d8: 022dd1cb 00000000 08976190 00b8054c
0x0007f5e8: 00001000 0000af89 00001000 6d7d1061
Instructions: (pc=0x00b8c9f8)
0x00b8c9e8: 89 5f 20 c1 e8 09 c6 80 00 a9 6c 48 00 8b 72 20
0x00b8c9f8: 89 7e 1c c1 ee 09 c6 86 00 a9 6c 48 00 8b e5 5d
Stack: [0x00040000,0x00080000), sp=0x0007f578, free space=253k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
J org.metabrick.xbird.util.collections.Int2LongHash$Int2LongLRUMap$ChainedEntry.recordRemoval(Lorg/metabrick/xbird/util/collections/Int2LongHash;)V
J org.metabrick.xbird.util.collections.Int2LongHash.remove(I)J
J org.metabrick.xbird.util.collections.Int2LongHash$Int2LongLRUMap.addEntry(IIJLorg/metabrick/xbird/util/collections/Int2LongHash$BucketEntry;)V
J org.metabrick.xbird.util.collections.Int2LongHash.put(IJ)J
J org.metabrick.xbird.xquery.util.StringChunk.storeCharChunk([CII)J
J org.metabrick.xbird.xquery.util.StringChunk.store([CII)J
J org.metabrick.xbird.xquery.dm.dtm.BigDocumentTable.setTextAt(J[CII)J
J org.metabrick.xbird.xquery.dm.dtm.DocumentTableBuilder.createTextNode()V
J org.metabrick.xbird.xquery.dm.dtm.DocumentTableBuilder.endElement(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
J com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(Lcom/sun/org/apache/xerces/internal/xni/QName;Lcom/sun/org/apache/xerces/internal/xni/Augmentations;)V
J com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanEndElement()I
J com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Z)Z
v ~OSRAdapter
j com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Z)Z+24
j com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Z)Z+118
j com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Lcom/sun/org/apache/xerces/internal/xni/parser/XMLInputSource;)V+29
j com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Lcom/sun/org/apache/xerces/internal/xni/parser/XMLInputSource;)V+9
j com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Lorg/xml/sax/InputSource;)V+43
j org.metabrick.xbird.xquery.dm.instance.DocumentTableModel.loadDocument(Ljava/io/InputStream;)V+35
j org.metabrick.xbird.client.tools.command.ImportDocument.process([Ljava/lang/String;)Z+102
j org.metabrick.xbird.client.tools.CommandInvoker.executeCommand([Ljava/lang/String;)Z+8
j org.metabrick.xbird.client.tools.CommandInvoker.run([Ljava/lang/String;)V+66
j org.metabrick.xbird.client.tools.CommandInvoker.main([Ljava/lang/String;)V+19
v ~StubRoutines::call_stub
V [jvm.dll+0x845a9]
V [jvm.dll+0xd9317]
V [jvm.dll+0x8447a]
V [jvm.dll+0x8b44a]
C [java.exe+0x14c5]
C [java.exe+0x64dd]
C [kernel32.dll+0x16fd7]
--------------- P R O C E S S ---------------
Java Threads: ( => current thread )
0x00aa7490 JavaThread "Low Memory Detector" daemon [_thread_blocked, id=1780]
0x00aa60f0 JavaThread "CompilerThread0" daemon [_thread_blocked, id=3456]
0x00aa53f8 JavaThread "Signal Dispatcher" daemon [_thread_blocked, id=2544]
0x00a96c80 JavaThread "Finalizer" daemon [_thread_blocked, id=856]
0x00a957e8 JavaThread "Reference Handler" daemon [_thread_blocked, id=816]
=>0x00036190 JavaThread "main" [_thread_in_Java, id=1608]
Other Threads:
0x0003fbd0 VMThread [id=3592]
0x00ab0e20 WatcherThread [id=3108]
VM state:not at safepoint (normal execution)
VM Mutex/Monitor currently owned by a thread: None
Heap
def new generation total 72576K, used 59965K [0x02ae0000, 0x079a0000, 0x079a0000)
eden space 64512K, 80% used [0x02ae0000, 0x05d8f7b0, 0x069e0000)
from space 8064K, 99% used [0x069e0000, 0x071bfff8, 0x071c0000)
to space 8064K, 0% used [0x071c0000, 0x071c0000, 0x079a0000)
tenured generation total 967936K, used 451270K [0x079a0000, 0x42ae0000, 0x42ae0000)
the space 967936K, 46% used [0x079a0000, 0x23251ab0, 0x23251c00, 0x42ae0000)
compacting perm gen total 8192K, used 5367K [0x42ae0000, 0x432e0000, 0x46ae0000)
the space 8192K, 65% used [0x42ae0000, 0x4301dfb0, 0x4301e000, 0x432e0000)
No shared spaces configured.
Dynamic libraries:
0x00400000 - 0x0040c000 C:\Program Files\Java\jdk1.5.0_06\bin\java.exe
0x7c940000 - 0x7c9dd000 C:\WINDOWS\system32\ntdll.dll
0x7c800000 - 0x7c931000 C:\WINDOWS\system32\kernel32.dll
0x77d80000 - 0x77e29000 C:\WINDOWS\system32\ADVAPI32.dll
0x77e30000 - 0x77ec1000 C:\WINDOWS\system32\RPCRT4.dll
0x77bc0000 - 0x77c18000 C:\WINDOWS\system32\MSVCRT.dll
0x6d6e0000 - 0x6d874000 C:\Program Files\Java\jdk1.5.0_06\jre\bin\client\jvm.dll
0x77cf0000 - 0x77d7f000 C:\WINDOWS\system32\USER32.dll
0x77ed0000 - 0x77f17000 C:\WINDOWS\system32\GDI32.dll
0x76af0000 - 0x76b1b000 C:\WINDOWS\system32\WINMM.dll
0x762e0000 - 0x762fd000 C:\WINDOWS\system32\IMM32.DLL
0x60740000 - 0x60749000 C:\WINDOWS\system32\LPK.DLL
0x73f80000 - 0x73feb000 C:\WINDOWS\system32\USP10.dll
0x6d2f0000 - 0x6d2f8000 C:\Program Files\Java\jdk1.5.0_06\jre\bin\hpi.dll
0x76ba0000 - 0x76bab000 C:\WINDOWS\system32\PSAPI.DLL
0x6d6b0000 - 0x6d6bc000 C:\Program Files\Java\jdk1.5.0_06\jre\bin\verify.dll
0x6d370000 - 0x6d38d000 C:\Program Files\Java\jdk1.5.0_06\jre\bin\java.dll
0x6d6d0000 - 0x6d6df000 C:\Program Files\Java\jdk1.5.0_06\jre\bin\zip.dll
0x6d530000 - 0x6d543000 C:\Program Files\Java\jdk1.5.0_06\jre\bin\net.dll
0x719e0000 - 0x719f7000 C:\WINDOWS\system32\WS2_32.dll
0x719d0000 - 0x719d8000 C:\WINDOWS\system32\WS2HELP.dll
0x6d550000 - 0x6d559000 C:\Program Files\Java\jdk1.5.0_06\jre\bin\nio.dll
VM Arguments:
jvm_args: -Xmx1024m -Xms1024m -ea
java_command: org.metabrick.xbird.client.tools.CommandInvoker -col /xmark import document C:\Software\xmark\xmark100.xml
Launcher Type: SUN_STANDARD
Environment Variables:
JAVA_HOME=C:\Program Files\Java\jdk1.6.0
PATH=C:\Program Files\Java\jdk1.6.0\bin;D:\Software\maven-1.0.2\bin;D:\cygwin\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;D:\Software\apache-ant-1.6.5\bin;C:\ghc\ghc-6.4.2\bin;C:\Program Files\QuickTime\QTSystem\
USERNAME=yui
OS=Windows_NT
PROCESSOR_IDENTIFIER=x86 Family 15 Model 4 Stepping 4, GenuineIntel
--------------- S Y S T E M ---------------
OS: Windows XP Build 2600 Service Pack 2
CPU:total 2 family 15, cmov, cx8, fxsr, mmx, sse, sse2, ht
Memory: 4k page, physical 2096404k(370660k free), swap 3511144k(1545452k free)
vm_info: Java HotSpot(TM) Client VM (1.5.0_06-b05) for windows-x86, built on Nov 10 2005 11:12:14 by "java_re" with MS VC++ 6.0 -
Java Code to Convert GIF to BMP
Hi,
Could anyone please tell me the Java Code to convert the GIF image to BMP image.
Thanks,
RathishHere is a sample code for reading an Excel file. It uses JExcel API:
package com.quicklyjava;
import jxl.*;
import jxl.read.biff.BiffException;
import java.io.File;
import java.io.IOException;
public class JavaExcelRead {
* @param args
public static void main(String[] args) {
try {
//Create a workbook object from the file at specified location.
//Change the path of the file as per the location on your computer.
Workbook wrk1 = Workbook.getWorkbook(new File("C:/test.xls"));
//Obtain the reference to the first sheet in the workbook
Sheet sheet1 = wrk1.getSheet(0);
//Obtain reference to the Cell using getCell(int col, int row) method of sheet
Cell colArow1 = sheet1.getCell(0, 0);
Cell colBrow1 = sheet1.getCell(1, 0);
Cell colArow2 = sheet1.getCell(0, 1);
//Read the contents of the Cell using getContents() method, which will return
//it as a String
String str_colArow1 = colArow1.getContents();
String str_colBrow1 = colBrow1.getContents();
String str_colArow2 = colArow2.getContents();
//Display the cell contents
System.out.println("Contents of cell Col A Row 1: \""+str_colArow1 + "\"");
System.out.println("Contents of cell Col B Row 1: \""+str_colBrow1 + "\"");
System.out.println("Contents of cell Col A Row 2: \""+str_colArow2 + "\"");
} catch (BiffException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
You can further process this to convert the data extracted into XML. Hope this helps! -
How to use Java code signing certificate in oracle 11i
Hello,
I am try to configure java code signing certificate in 11.5.10.2 application. we got java sign certificate from verisgin. SA's imported the certificate and created alias XXX_XXX with password and passphrase.
I am able to see the my certificate. keytool -list -v -keystore xxx_xxxx.jks -storepass Password.
how do I use it. I am using Enhance Jar Signing for EBS DOC ID 1591073.1.
could you please give me some advice on it?
Thanks
PrinceHussien,
I find out apps keystore keypassword and storepassword, I imported the java code sign certificate. I generated Jar files through adadmin, but I am getting warning error
adogif() unable to generate Jar Filers under JAVA_TOP.
executing /usr/jdk/jdk1.6.0_45/bin/java sun.security.tools.JarSigner keysotre **** -sigfile CUST Signer /apps/......
Error JarSigner subcommand Exited With status 1.
No standard output from jarsigner JarSigner error output: Exception in thread "main" java.lang.NoClassDefFoundError: sun/security/tools/JarSigner Caused by: java.lang.ClassNotFoundException: sun.security.tools.JarSigner at java.net.URLClassLoader$1.run(URLClassLoader.java:202) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:190) at java.lang.ClassLoader.loadClass(ClassLoader.java:306) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) at java.lang.ClassLoader.loadClass(ClassLoader.java:247) Could not find the main class: sun.security.tools.JarSigner. Program will exit. WARNING: The following path(s), defined in /apps2/property/product/tst/appl/cz/11.5.0/java/make/czjar.dep as elements of the output: oracle/apps/cz/runtime/tag WARNING: Copying cztag.lst from the old fndlist.jar ... About to Analyze flmkbn.jar : Fri Nov 22 2013 10:45:51
Please let me know if you have any idea. Thanks Prince -
How to call a .bat file from java code?
How to call a .bat file from java code? and how can i pass parameters to that .bat file?
Thanks in advancethanks for ur reply
but still i am getting the same error.
I am trying to run a .bat file of together tool, my code looks like below
import java.lang.Runtime;
import java.lang.Process;
import java.io.File;
class SysCall{
public static void main(String args[]){
String cmd="D://Borland//Together6.2//bin//Together.bat -script:com.togethersoft.modules.qa.QA -metrics out:D://MySamples//Metrics// -fmt:html D://Borland//Together6.2//samples//java//CashSales//CashSales.tpr";
//String path="D://Borland//Together6.2//bin//Together.bat ";
Runtime r= Runtime.getRuntime(); //Declare the system call
try{
System.out.println("Before batch is called");
Process p=r.exec(cmd);
System.out.println(" Exit value =" + p.exitValue());
System.out.println("After batch is called");
/*can produce errors which must be caught*/
catch(Exception e) {
e.printStackTrace();
System.out.println (e.toString());
I am getting the below exception
Before batch is called
java.lang.IllegalThreadStateException: process has not exited
at java.lang.Win32Process.exitValue(Native Method)
at SysCall.main(SysCall.java:17)
java.lang.IllegalThreadStateException: process has not exited -
How to get the shared name of a folder in my PC through java code.
Hi,
I have a shared folder in my PC adn its shared name is different. Is there any way to get the shared name of that folder from java code. I have the absolute path of that dir. Can I get the shared name from that path in java or is there any other method.
Thanks.
Edited by: pavanspecial on Nov 28, 2007 11:34 PMHi, Thanks for your reply. I have even tried through 'net share' , but i could not the share name from the path i have. For the 'net share' i need to give the share name itself.
Maybe you are looking for
-
3GS Voice Memo appears in phone will not sync to iTunes
Yes, I'm on an antiquated phone but refuse to switch until a real 4G iPhone is released! I recorded a very important interview yesterday. No matter what I do it will not sync to iTunes on my MBP. I'm running 10.6.8 Snow Leopard and iTunes 10 with all
-
Where can I get an older version of Flash builder (4.5)
I'm callobarating on a project and I need Flash builder 4.5. Where can I download it. I have a cloud pro account
-
Missing texts in WEB with F4-help combined with variable input.
I've defined a characteristic with text : short text, medium length text and long text. The texts are language independent. I've defined a variable for this characteristic and I've defined a BEX-report that provides a variable-filter for this charact
-
How to create a custom theme for discussions similar to jive?
I have worked in Jive earlier and saw that there was greater flexibility in the way you can work with themes. Oracle has extended it and looks most of the features are removed. In Jive, I was able to create a new theme and was able to change the look
-
Daisy chain FW 800 issues!
I'm having problems getting my ext. hard drives to daisy chain via the FW 800 ports! Sometimes it will connect the first drive but when I try to daisy chain a 2nd drive to the 1st, it either bumps it off or does nothing, and it worked a few hours ago