Java program code paper work
Where to find industrial standards for Java program code paper work (indents, large or small characters, brackets position on page, capital letters for constants etc.)?
Usually, this will depend where you're working. Each has its own standards , but here's Sun's coding standards:
http://java.sun.com/docs/codeconv/html/CodeConvTOC.doc.html
Similar Messages
-
Java Script Code not working properly for visios in sharepoint 2013
Hi all ,
I have few visios and I am using the visio web part to display and to redirect from one visio to other visio I am using the java script code through content editor web part .
In share point 2010 it's working fine , I was able to redirect to all the visios and code is working fine .
In share point 2013 its not the same , Its not working properly . only for the first time the code is working fine . once it goes to next visio the code stops working .
For example if i click in visio A it gets redirect to Visio B and its stops working , it wont allow to do any other steps .
I have checked with the URL its correct , I am not able to find any error also .
IndreshThis will be likely caused by the Minimal Download Strategy not registering the Javascript on the page reload. You can turn off the MDS feature to test this.
You can either turn off MDS in your site, or register your Javascript functions with MDS to ensure they are called. To do this, you'll need all of your code to be wrapped in a javascript file (Embed this on the page using a <script> tag and
inside that file in a function, which you then register with MDS as follows (I usually do this in the first line of the javascript file):-
RegisterModuleInit("/SiteAssets/YourJavaScriptFile.js", NameOfYourFunction);
Regards
Paul.
Please ensure that you mark a question as Answered once you receive a satisfactory response. This helps people in future when searching and helps prevent the same questions being asked multiple times. -
Java programs do not work correctly in my computer.
This is very simple. Every java program I have, such as the Java Control Panel or the LimeWire (downloads program) can't work correctly, meaning the program's window appears but not its content; showing a blank window instead of showing me the program. I have reinstalled the complete java software several times but nothing changes.
I will appreciate a quick answer, and sorry for my bad english, thanks...
Tomas. Buenos Aires, Argentina.OHHHHH!!! HOW STUBBORN I AM!!!. You were right, the problem started after my video card was reinstalled!. Thanks for the link, in fact, the porblem is perfectly registred by Java:
www.java.com/en/download/help/5000041100.xml
Thanks, this forum is the bbbest one ever!.
Tomas, Buenos Aires, Argentina. -
My java programe does not work
Hi
I createda java programme with jdeveloper . I compiled my code in all of version (1.3, 1.4, 1.5, 1.6 and default).
But when i try to run my programme in other computers that have j2SE Runtime Environment 5.0 update 11, or java Runtime 2 Environment SE 1.3 - 1.4,
my programme doesnot work.
how can i fix this problem.Which Jdev version?
What exactly do you mean by 'does not work'?
Timo -
My first Java program does;'t work HELP
I received the following message in the Command Prompt:Exception in thread "main" java.land.NoClassDefFoundError: Test
How do I fix this?
Source Code:
import java.awt.MediaTracker;
class Test {
public static void main(String[] args) {
for (int i = 0; i < args.length; i++)
System.out.print(i == 0 ? args[i] : " " + args);
System.out.println();You might want to make your class public, although I don't think that's supposed to be necessary. It's most likely a classpath issue.
Instead of java Test, try java -cp . Test (Note the dot between -cp and Test.)
Javapedia: Classpath
How Classes are Found
Setting the class path (Windows)
Setting the class path (Solaris/Linux)
Understanding the Java ClassLoader
java -cp .;<any other directories or jars> YourClassNameYou get a NoClassDefFoundError message because the JVM (Java Virtual Machine) can't find your class. The way to remedy this is to ensure that your class is included in the classpath. The example assumes that you are in the same directory as the class you're trying to run.
javac -classpath .;<any additional jar files or directories> YourClassName.javaYou get a "cannot resolve symbol" message because the compiler can't find your class. The way to remedy this is to ensure that your class is included in the classpath. The example assumes that you are in the same directory as the class you're trying to run. -
Not able to connect mysql server from java program
Hi
I have mysql server running in one machine and I am accessing from another machine using java program. I have added an user from the server and given all the permission. But its not working. But when I hav java program locally its working.
The following is my program
private Connection getConnection(){
Connection con=null;
try{
Class.forName("com.mysql.jdbc.Driver");
String url="jdbc:mysql://10.5.18.135:3306/test";
con = DriverManager.getConnection(url,"new","");
System.out.println("Connected");
}catch(Exception e){
System.out.println("Not Connected"+e);
e.printStackTrace();
return con;
its throwing me the follwoing exceptioon
Not Connectedjava.sql.SQLException: Unable to connect to any hosts due to exce
ion: java.net.ConnectException: Connection timed out: connect
java.sql.SQLException: Unable to connect to any hosts due to exception: java.n
.ConnectException: Connection timed out: connect
at com.mysql.jdbc.Connection.createNewIO(Connection.java:1690)
Thanks in advance
SathishTry this way I think you will need the user and password.
Connection con=null;
try{
Class.forName("com.mysql.jdbc.Driver");
// assuming database test
// assuming user is root
// assuming user password is me
String connectionString="jdbc:mysql://10.5.18.135:3306/test?user=root&password=me"
con = DriverManager.getConnection(connectionString);
[code/]
rykk -
Hi
I'm completely new to Java programming, I have worked for a year in Qbasic, but that is like kids play kind of programming, im unsure as to the similarities/differences between the 2 languages.
Also: I know that Java is an "Object oriented" form of programming, can anyone explain what this means?
Im going to start at the beginning of the manual, is it ok if i come here and ask questions if im stuck with anything? I don't know what the community is like here...
Thanks,
ChloeHere are some good introductions to OOP:
Object-Oriented Programming Concepts
Object-oriented language basics
Don't Fear the OOP
And here are some other great resources for beginning Javites:
http://java.sun.com/docs/books/tutorial/
http://java.sun.com/developer/onlineTraining/Programming/BasicJava1/compile.html
http://java.sun.com/learning/new2java/index.html
http://javaalmanac.com
http://www.jguru.com
http://www.javaranch.com
Bruce Eckel's Thinking in Java
Joshua Bloch's Effective Java
Bert Bates and Kathy Sierra's Head First Java
Good luck, and Happy Coding!
§ -
Makeing java programming friends
hi,thanks for focus on this.
i am a chinese guy,working for a federal software company,having about half and one years java programming studying and working experience,which are mainly about jsp and j2ee programming. i am not very good at english ,but i am working on it. so i wanna more communication .and i think,maybe ,to java beginner, my experiense can make some help,Surely,i am a beginner.so hope to meet many friends.
my msn is: [email protected]
my freqently used email is: [email protected]
Best Regards.
Ryan ZhangThen go over to the JSP forum and try answering some
questions. Even if you do not feel that your English
is good enough, still see if you can find an answer.
You do not have to actually post the answer. But if
you are confident in your answer, go ahead and post
it. Nobody will complain about your English skills.
Only if the answer is wrong, will people complain.That's a very good advice. I'm answering questions because I want to become better in English, and I have learnt many new words since I started answering, but I have to admit that most of the new words and expressions comes from the off topic threads, and from Annies posts :)
/Kaj -
How to run java programs on machines without JDK
I want to make an installer for my java program that would work on machines even without JDK or Java runtime. How should I go?
Here's another point.
There is no particular need to "install" anything to run java. You can simply copy the jre to a directory of your choice, and from that directory invioke the JVM as you need it. -
MySQL trying to connect my java program
I am trying to write a java program that I can connect to a MySQL database on my compter. I have typed out this example that is in a text book I have and I am trying to connect my java program to a MySQL database. The version of MySQL is 4.1 which I have recently downloaded onto my computer and is working fine. The problem I am having is in ther places where it says "WHAT DO I ENTER HERE", basically the 'database.properties' , the 'jdbc.drivers' and the 'jdbc.url' string names. I do not know what I am supposed to enter. If you could give me some help with what I am supposed to enter or an example of a java program that already works with MySQL that would be of great help to me. A working example would be the greatest help to me .
Thank-you.
import java.sql.*;
import java.io.*;
import java.util.*;
class TestDB
public static void main (String args[])
try
Connection conn = getConnection();
Statement stat = conn.createStatement();
stat.execute("CREATE TABLE Greetings (Name CHAR(20))");
stat.execute("INSERT INTO Greetings VALUES ('Hello World!')");
ResultSet result = stat.executeQuery("Select * From Greetings");
result.next();
System.out.println(result.getString(1));
result.close();
stat.execute("DROP TABLE Greetings");
stat.close();
conn.close();
catch (SQLException ex)
while (ex != null)
ex.printStackTrace();
ex = ex.getNextException();
catch (IOException ex)
ex.printStackTrace();
public static Connection getConnection() throws SQLException, IOException
Properties props = new Properties();
FileInputStream in = new FileInputStream("WHAT DO I ENTER HERE");
props.load(in);
in.close();
String drivers = props.getProperty("WHAT DO I ENTER HERE");
if(drivers != null)
System.setProperty("WHAT DO I ENTER HERE", drivers);
String url = props.getProperty("WHAT DO I ENTER HERE");
String username = props.getProperty("jdbc.username");
String password = props.getProperty("jdbc.password");
return
DriverManager.getConnection(url, username, password);
}public static Connection getConnection() throws SQLException, IOException {
Properties props = new Properties();
// It could be absolute or relative path.
// If the properties file is in the same dir, use the name as shown below.
FileInputStream in = new FileInputStream("database.properties");
props.load(in);
in.close();
// It will load the driver String from properties
String drivers = props.getProperty("jdbc.drivers");
if(drivers != null)
System.setProperty("jdbc.drivers", drivers);
// If drivers are not set in properties, set them now.
String url = props.getProperty("jdbc.url");
String username = props.getProperty("jdbc.username");
String password = props.getProperty("jdbc.password");
return DriverManager.getConnection(url, username, password);
}Have a look at the comments I inserted. :) -
Calling javaFX script from Java program
I am trying to call JavaFX script from a simple Java program. code as follows:
import java.io.*;
import javax.script.ScriptEngine;
import javax.script.ScriptEngineManager;
public class My{
public static void main(String[] args) {
ScriptEngineManager manager = new ScriptEngineManager();
ScriptEngine engine = manager.getEngineByExtension("fx");
try {
InputStreamReader reader = new InputStreamReader(My.class.getResourceAsStream("first.fx"));
engine.eval(reader);
reader.close();
} catch (Exception e) {
e.printStackTrace();
my first.fx file code is here:
import javafx.stage.Stage;
import javafx.scene.Scene;
import javafx.scene.text.Text;
import javafx.scene.text.Font;
import javafx.scene.text.TextAlignment;
Stage {
title: "My First JavaFX Sphere"
scene: Scene {
width: 250
height: 250
content: [
Text {
font: Font { size: 24 }
x: 20, y: 90
textAlignment: TextAlignment.CENTER
content:"Welcome to \nJavaFX World"
} //Text
] // content
} // Scene
} // Stage
I am not able to run My.java. runtime error as follows:
java.lang.NullpointerException
Kindly correct me, where I am wrongI am able to call .fx file from Java. Thank you all for helping me to resolve this problem
Regards,
Ritu -
How to run java older version java program with newer version 1.6.
Hello frds.....i have a one query regarding jkd newer version. I was using older version of jdk 1.4 for my java program and projects' work. Now i installed newer version of java 1.6 in my machine, so when i tried to compile and run my older version programs in the newer version, its showing many errors. So can anybody helps me on this query that how can i run my older version java programs in newer version 1.6 or what types of changes i will be do in my java programs.
Thanks in advance
KshitizEJP wrote:
so when i tried to compile and run my older version programs in the newer version, its showing many errorsI doubt it. There is only one incompatibility between 1.4 and 1.6, and that is the introduction of the 'assert' keyword. (or did that happen in 1.4?)I believe that was the one and only incompatible change made in 1.4.
(Although I'm saying that from memory, and 1.4 was a long time ago -- so the "one and only" part could be wrong.) -
This is the program I wrote LineRect just to draw a line a rectangle etc...... Y it is not working How can i used the same program to run without using applet that is by using awt and swing.........Pls Help me.............
import java.awt.*;
import java.io.*;
public class LineRect
{public void paint(Graphics g)
{g.drawLine(10,10, 50,50);
g.drawRect(10, 60, 40,30);
g.fillRect(60,10,30,80);
g.drawRoundRect(10,100,80,50,10,10);
g.fillRoundRect(20,110,60,30,5,5);
g.drawLine(100,10,230,140);
g.drawLine(100,140,230,10);
<APPLET
CODE =LineRect.class
WIDTH=250
HEIGHT=200>
</APPLET>There are many significant errors here for instance you are using a class file as if it were an applet yet you do not subclass applet. Your code has no init method (if it is to be an applet). Your best bet is to go through the tutorials one step at a time. One thing to consider is to subclass a JPanel and draw on the jpanel overriding the paintComponent method. This can then be added to a JFrame or a JApplet's contentPane and would allow the same graphics in both. But again, please study the tutorials on all of this, otherwise you will be doing hit-or-miss programming, and that is no way to learn.
Much luck!
Addendum: Also, if you are just beginning in Java programming, I suggest you start with the basics and not with Swing / AWT / graphics programming. Otherwise you will just end up bruised and disappointed. You have to learn to walk before you can run.
Edited by: Encephalopathic on Dec 26, 2007 5:09 AM -
PAPI Client program is not working
Hi,
i'm running a sample bpm project in albpm studio 5.7
and tried to get the instance details thru PAPI client, but im getting following exception.
pls help me.
Code:*
package papi.example;
import java.io.Serializable;
import java.util.Properties;
import fuego.papi.CommunicationException;
import fuego.papi.InstanceInfo;
import fuego.papi.OperationException;
import fuego.papi.ProcessService;
import fuego.papi.ProcessServiceSession;
public class PapiExample implements Serializable {
private static final long serialVersionUID = 6828488904644822028L;
public static void main(String[] args) throws Exception {
Properties configuration = new Properties();
configuration.setProperty(ProcessService.DIRECTORY_ID, "default");
configuration
.setProperty(ProcessService.PROJECT_PATH,
"C:/Documents and Settings/458232/bpmProjects/ExpenseManagement.fpr");
configuration
.setProperty(ProcessService.WORKING_FOLDER,
"/tmp");
try {
ProcessService processService = ProcessService
.create(configuration);
ProcessServiceSession session = processService.createSession(
"Peter Jones", "", "localhost");
for (String processId : session.processesGetIds()) {
System.out.println("\n Process: " + processId);
for (InstanceInfo instance : session
.processGetInstances(processId)) {
System.out.println(" -> " + instance.getId());
session.close();
processService.close();
} catch (CommunicationException e) {
System.out.println("Could not connect to Directory Service");
e.printStackTrace();
} catch (OperationException e) {
System.out.println("Could not perform the requested operation");
e.printStackTrace();
Exception*:
Local folder /tmp\system\Schema3387192-1626570987\catalogs found.
Loading catalogs from local folder: /tmp\system\Schema3387192-1626570987\catalogs
0 jars found locally.
[CatalogMgrCache] =======================
Registering CatalogMgr [ExpenseManagement.fpr] ...CatalogManagerCache 25934938:
Managers:
Counters:
[CatalogMgrCache] =======================
CatalogMgr [ExpenseManagement.fpr] REGISTERED!CatalogManagerCache 25934938:
Managers:
{ExpenseManagement.fpr=fuego.util.LocalCatalogManager@facf0b}
Counters:
Could not enhance type with bytecode info: java.lang.NoClassDefFoundError: org/apache/bcel/classfile/EmptyVisitor
Could not enhance type with bytecode info: java.lang.NoClassDefFoundError: org/apache/bcel/classfile/EmptyVisitor
Could not enhance type with bytecode info: java.lang.NoClassDefFoundError: org/apache/bcel/classfile/EmptyVisitor
Could not enhance type with bytecode info: java.lang.NoClassDefFoundError: org/apache/bcel/classfile/EmptyVisitor
Could not enhance type with bytecode info: java.lang.NoClassDefFoundError: org/apache/bcel/classfile/EmptyVisitor
Could not enhance type with bytecode info: java.lang.NoClassDefFoundError: org/apache/bcel/classfile/EmptyVisitor
Could not enhance type with bytecode info: java.lang.NoClassDefFoundError: org/apache/bcel/classfile/EmptyVisitor
Could not enhance type with bytecode info: java.lang.NoClassDefFoundError: org/apache/bcel/classfile/EmptyVisitor
Could not enhance type with bytecode info: java.lang.NoClassDefFoundError: org/apache/bcel/classfile/EmptyVisitor
Could not enhance type with bytecode info: java.lang.NoClassDefFoundError: org/apache/bcel/classfile/EmptyVisitor
Could not enhance type with bytecode info: java.lang.NoClassDefFoundError: org/apache/bcel/classfile/EmptyVisitor
Could not enhance type with bytecode info: java.lang.NoClassDefFoundError: org/apache/bcel/classfile/EmptyVisitor
Could not enhance type with bytecode info: java.lang.NoClassDefFoundError: org/apache/bcel/classfile/EmptyVisitor
Could not enhance type with bytecode info: java.lang.NoClassDefFoundError: org/apache/bcel/classfile/EmptyVisitor
Could not enhance type with bytecode info: java.lang.NoClassDefFoundError: org/apache/bcel/classfile/EmptyVisitor
Process: /ExpenseReport#Default-1.0
Unreachable Engine Tolerance (seconds):
by default: 0
to be used: 0
This papi client will not cache exceptions which imply that an engine could not be reached.
The connection to 'tcp://01HW316455:8586' was refused. Details:
tcp://01HW316455:8586. Details: java.io.EOFException)
Caused by: An exception occurred while attempting to connect to: tcp://01HW316455:8586
Caused by: java.io.EOFException
fuego.papi.impl.rmi.EngineLocationStatus$EngineCrashedException: tcp://01HW316455:8586. Details: java.io.EOFException)
at fuego.papi.impl.rmi.EngineLocationStatus.get(EngineLocationStatus.java:92)
at fuego.papi.impl.rmi.RMIUtils.connectToLocation(RMIUtils.java:136)
at fuego.papi.impl.rmi.RMIUtils.connectToEngine(RMIUtils.java:111)
at fuego.papi.impl.rmi.RMIEngineAccessImpl.createSecureEngineProxy(RMIEngineAccessImpl.java:153)
at fuego.papi.impl.rmi.RMIEngineAccessImpl.createSecureEngine(RMIEngineAccessImpl.java:105)
at fuego.papi.impl.ProcessServiceImpl.createSecureEngine(ProcessServiceImpl.java:1222)
at fuego.papi.impl.ProcessServiceSessionImpl$2.run(ProcessServiceSessionImpl.java:3641)
at fuego.papi.impl.ProcessServiceImpl.executeEngineOp(ProcessServiceImpl.java:1858)
at fuego.papi.impl.ProcessServiceSessionImpl.getSecureEngine(ProcessServiceSessionImpl.java:3649)
at fuego.papi.impl.ProcessServiceImpl.createProcessControl(ProcessServiceImpl.java:1208)
at fuego.papi.impl.ProcessServiceSessionImpl$1.run(ProcessServiceSessionImpl.java:2481)
at fuego.papi.impl.ProcessServiceImpl.executeEngineOp(ProcessServiceImpl.java:1858)
at fuego.papi.impl.ProcessServiceSessionImpl.getProcessControl(ProcessServiceSessionImpl.java:2486)
at fuego.papi.impl.ProcessServiceSessionImpl.processGetInstances(ProcessServiceSessionImpl.java:2155)
at papi.example.PapiExample.main(PapiExample.java:41)
Caused by: fuego.rmi.spi.ConnectException: An exception occurred while attempting to connect to: tcp://01HW316455:8586
at fuego.rmi.ClientCluster.initialize(ClientCluster.java:486)
at fuego.rmi.ClientCluster.<init>(ClientCluster.java:107)
at fuego.rmi.ClientCluster.find(ClientCluster.java:228)
at fuego.rmi.RemoteProxy.<init>(RemoteProxy.java:73)
at fuego.papi.impl.rmi.PublicEngineProxy.<init>(PublicEngineProxy.java:33)
at fuego.papi.impl.rmi.EngineLocationStatus.createPublicEngine(EngineLocationStatus.java:109)
at fuego.papi.impl.rmi.EngineLocationStatus.get(EngineLocationStatus.java:44)
... 14 more
Caused by: java.io.EOFException
at java.io.DataInputStream.readShort(Unknown Source)
at fuego.rmi.Packet.read(Packet.java:129)
at fuego.rmi.spi.BaseConnection$Receiver.run(BaseConnection.java:190)
fuego.papi.ProcessNotAvailableException: Process '/ExpenseReport#Default-1.0' not available.
at fuego.papi.impl.ProcessServiceImpl.createProcessControl(ProcessServiceImpl.java:1215)
at fuego.papi.impl.ProcessServiceSessionImpl$1.run(ProcessServiceSessionImpl.java:2481)
at fuego.papi.impl.ProcessServiceImpl.executeEngineOp(ProcessServiceImpl.java:1858)
at fuego.papi.impl.ProcessServiceSessionImpl.getProcessControl(ProcessServiceSessionImpl.java:2486)
at fuego.papi.impl.ProcessServiceSessionImpl.processGetInstances(ProcessServiceSessionImpl.java:2155)
at papi.example.PapiExample.main(PapiExample.java:41)
Caused by: fuego.papi.impl.EngineNotAvailableException: Engine 'ExpenseManagement.fpr' cannot process requests.
at fuego.papi.impl.rmi.RMIUtils.connectToEngine(RMIUtils.java:119)
at fuego.papi.impl.rmi.RMIEngineAccessImpl.createSecureEngineProxy(RMIEngineAccessImpl.java:153)
at fuego.papi.impl.rmi.RMIEngineAccessImpl.createSecureEngine(RMIEngineAccessImpl.java:105)
at fuego.papi.impl.ProcessServiceImpl.createSecureEngine(ProcessServiceImpl.java:1222)
at fuego.papi.impl.ProcessServiceSessionImpl$2.run(ProcessServiceSessionImpl.java:3641)
at fuego.papi.impl.ProcessServiceImpl.executeEngineOp(ProcessServiceImpl.java:1858)
at fuego.papi.impl.ProcessServiceSessionImpl.getSecureEngine(ProcessServiceSessionImpl.java:3649)
at fuego.papi.impl.ProcessServiceImpl.createProcessControl(ProcessServiceImpl.java:1208)
... 5 more
Could not perform the requested operationI think problem is with your working folder.
configuration.setProperty(ProcessService.WORKING_FOLDER,"/tmp");
set it to where exactly your application folder path. -
hi,
I have VC++ code.
I want to run java program from VC++ (SDK).
Can I call it?
plz help it's urgent....
thanks in advance...We do it all the time using the JNI invocation API (this is actually how the java.exe application works).
Here's a tutorial I just found (not sure how good it is, but it should get you going):
http://www.inonit.com/cygwin/jni/invocationApi/
One note: If you are going to be invoking the JVM from different threads in your native app, there is some special handling you will have to do - the above tutorial doesn't address this scenario (a dig through the JNI docs should help with that one, though).
Cheers,
- K
Maybe you are looking for
-
Can't open files in Doc Library with IE
hello all: I have a document library which has recently shown an issue. There are many users that access this library with no problem. Recently, a few users (3-4) have complained that they are no longer able to view files. They are definitely able
-
IPhoto 08 vs Adobe Photoshop elements 6
I have just recently started to really enjoy digital photography and digital scrapbooking. I bought my first MAC about 2 months ago (20" iMac) and love it. I also purchased my first SLR camera and have really dived into photography being a hobby and
-
IDOC creation from flat file.
Hello Friends. I need to create a custom program for posting goods receipts for a purchase order. I think a custom program needed to achieve this task because i need to do mappings prior to create an IDOC. Now using a flat file what are the functio
-
The volumn is very low on the computer or playing CD's.
I do not Skype or anything like that - all I want to do is to listen to & burn CD's, but I haven't been able to do so as the volumn is too low. I attached speakers (speakers which were on my old computer & worked fine), but the volumn is very faint
-
Performance Tuning for non Administrator users
Hi, Since i had performance issue on my cube i have followed tutorial: http://www.oracle.com/technology/obe/obe_bi/bi_ee_1013/aggpersist/aggpersist.htm to obtain best performance using aggregate tables. All works, but opening NQSQuery.log i've seen t