|
|
Obviously when it is a "folder read & write permission issue" then you fix it by fixing that issue.
And that is not a java issue.
|
|
|
|
|
bro it works properly when i open and run it in netbeans but when i create its setup and install and run it , it give the error.
|
|
|
|
|
It is no good reposting this information repeatedly, until you have found out why you are prevented from writing to this database. Look at the directories where the files are installed and check the permissions on them, and do the same for all associated files.
|
|
|
|
|
Thank you bro u solved the problem tnx again
|
|
|
|
|
I'm quite new to Java, and recently I've been experimenting with the GridbagLayout manager...
Specifically I'm using it to define panels for a Choose-your-own-adventure game...
As, time passed I noticed that I had created an overwhelming long piece of code...
The number of panes that were essentially identical aside from the text I had put into each of their respective JTextAreas, coupled with the inherent length of the calibrating each Jpanel's GridbagLayout has caused my code to balloon up to a ridiculous degree...
...
So, my question is this:
Is there a method of reducing the immense length of such a piece of code...
Thanks in advance...
|
|
|
|
|
Member 12229369 wrote: Is there a method of reducing the immense length of such a piece of code... Yes, there are many methods. However, without some more specific details it is anyone's guess what they should be.
|
|
|
|
|
Hi, I want to combine the two variables Variable1 and Variable2, but I couldn't combine them.
This is a separate class java file:
public class AnswerList {
private int mQuestion;
private int mAnswer;
private int mChoice1;
private int mChoice2;
private int mChoice3;
private int mChoice4;
public AnswerList(int question, int choice1, int choice2, int choice3, int choice4, int answer){
mQuestion = question;
mAnswer = answer;
mChoice1 = choice1;
mChoice2 = choice2;
mChoice3 = choice3;
mChoice4 = choice4;
}
I have to declared the two variables separately because I want to combine the two only if certain conditions are met. The issue I have is I can't get the combining to work.
private AnswerList[] Variable1 = new AnswerList[] {
new AnswerList(R.string.question1, R.string.answerone1,
R.string.answerone2, R.string.answerone3,
R.string.answerone4, 4),
new AnswerList(R.string.question2, R.string.answertwo1,
R.string.answertwo2, R.string.answertwo3, R.string.answertwo4, 2)};
private AnswerList[] Variable2 = new AnswerList[]{
new AnswerList(R.string.question5, R.string.answerfive1,
R.string.answerfive2, R.string.answerfive3,
R.string.answerfive4, 1)
};
I tried to used the following codes to combine them, but none of them worked. What am I doing wrong? Thanks!
Note: I am a Java/Android beginner.
Arrays combined = ArrayUtils.addAll(Variable1,Variable2);
Collections.addAll(Variable1,Variable2);
|
|
|
|
|
|
As Richard advised - use collection instead of fixed-length arrays: I think this will be more useful for the beginner:
private ArrayList<AnswerList> Variable1 = new ArrayList<AnswerList>();
private ArrayList<AnswerList> Variable2 = new ArrayList<AnswerList>();
Variable1.add(new AnswerList(R.string.question1, R.string.answerone1,
R..string.answerone2, R.string.answerone3,
R.string.answerone4, 4));
Variable1.add(new AnswerList(R.string.question2, R.string.answertwo1,
R.string.answertwo2, R.string.answertwo3,
R.string.answertwo4, 2));
Variable12.add(new AnswerList(R.string.question5, R.string.answerfive1,
R.string.answerfive2, R.string.answerfive3,
R.string.answerfive4, 1));
Once your collections are populated and certain condition is met, you can call someting like
ArrayList<AnswerList> collatedList = collateAnswers(Variable1, Variable2);
Function collateAnswers() is deliberatly implemented in "step-by-step" way - for the beginner's benifits.
public ArrayList<AnswerList> collateAnswers(ArrayList<AnswerList> lst1, ArrayList<AnswerList> lst2){
ArrayList<AnswerList> lst = new ArrayList<AnswerList>();
for(AnswerList x : lst1){
lst.add(x);
}
for(AnswerList x : lst2){
lst.add(x);
}
return lst;
}
|
|
|
|
|
1)One String given(Ex-"2a3b4c...").How to print aabbbcccc.....like this.
2)How to check a given index in a String is number or char.
|
|
|
|
|
|
What is best to use. Mostly I use METHOD POST for this action (Add, Update, Delete)
In User Module.
1. Create Servlet for each Action (Login, Create, Update, Delete)
OR
2. In JSP for each FORM create a input hidden which contains the process (Login, Create, Update, Delete) and Create one Servlet that read this hidden input and process specific action.
- Be who you are and say what you feel because those who mind don't matter and those who matter don't mind.
- Most of the problem in your life are due to two reasons: you act without thinking, or think without acting.
|
|
|
|
|
I am writing a (TCP v4) server that accepts connections for all available network interfaces.
Server gets a value frim thouthends of clients and searches/sorts data based on that value. Then, returns an array of string values back to clients.
What is the best choice for this task: ExecutorService vs ForkJoinPool vs standard threads?
Here is the code for standard threads, is there anything to improve?
while (!Thread.currentThread().isInterrupted()) {
try (Socket socket = new ServerSocket(init()).accept()) {
new Thread(new Runnable() {
@Override
public void run() {
while (true) {
try (BufferedReader fromClient = new BufferedReader(new InputStreamReader(socket.getInputStream(), StandardCharsets.US_ASCII));
DataOutputStream outToClient = new DataOutputStream(socket.getOutputStream()); ) {
outToClient.write(autocomplete(fromClient.readLine()).getBytes("US-ASCII"));
} catch (IOException e) { Logger.getLogger(Server.class.getName()).log(Level.SEVERE, null, e.getMessage()); }
}
}
}).start();
} catch (IOException ex) { Logger.getLogger(Server.class.getName()).log(Level.SEVERE, null, ex.getMessage()); }
}
Code for ExecutorService:
final ExecutorService service = Executors.newCachedThreadPool();
while(!Thread.currentThread().isInterrupted()) {
service.submit(new Runnable() {
public void run() {
try (Socket socket = new ServerSocket(init()).accept();
BufferedReader fromClient = new BufferedReader(new InputStreamReader(socket.getInputStream(), StandardCharsets.US_ASCII));
DataOutputStream outToClient = new DataOutputStream(socket.getOutputStream());) {
outToClient.write(autocomplete(fromClient.readLine()).getBytes("US-ASCII"));
} catch (IOException e) {
service.shutdown();
Logger.getLogger(Server.class.getName()).log(Level.SEVERE, null, e.getMessage());
}
}
});
}
Or should I use ForkJoinPool...?
|
|
|
|
|
I want to add scrollbar to rowheader view of jscrollpane.
As i added my to row header of jscrollpane.
jscrollpane.setRowHeaderView(new JViewPort(mytable));
I want add scrollpane to rowheader part.
|
|
|
|
|
|
|
HOW CAN I START LERANING JAVA ANY IDEA
|
|
|
|
|
|
Java is case-sensitive, so the first step would be to buy a keyboard where the caps-lock key isn't stuck.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Search for java basic code , or read books on how to start in java programming..Its not that hard when your starting.
|
|
|
|
|
Hello
Please can you tell me where can i find the jar file with bold in the windows system?
I'm searching for that jar but i can't find it
Manifest-Version: 1.0
Ant-Version: Apache Ant 1.8.2
Created-By: 1.7.0_67-b01 (Oracle Corporation)
Main-Class: com.tpk.bilanc.O2App
Class-Path: lib\AbsoluteLayout.jar lib\BilancCFR.jar lib\BilancDynamic
Reports.jar lib\CJWizards-0.2.jar lib\DynamicJasper-4.0.3.jar lib\RXT
Xcomm.jar lib\barbecue-1.5-beta1.jar lib\commons-beanutils-1.8.2.jar
lib\commons-collections-3.2.1.jar lib\commons-dbcp-all-1.3.jar lib\co
mmons-digester-2.1.jar lib\commons-javaflow-20060411.jar lib\commons-
lang-2.6.jar lib\commons-lang3-3.1.jar lib\commons-logging-1.1.1.jar
lib\dom4j-1.6.jar lib\dynamicreports-core-3.1.3.jar lib\exp4j-0.3.10.
jar lib\gson-2.3.jar lib\hsqldb.jar lib\iReport.jar lib\iText-2.1.7.j
s2.jar lib\jackcess-2.0.6.jar lib\jasperreports-5.2.0.jar lib\jcommon
-1.0.15.jar lib\jdt-compiler-3.1.1.jar lib\jfreechart-1.0.12.jar lib\
jpf-0.4.jar lib\jpf-tools-0.4.jar lib\jtds-1.3.1.jar lib\junit.jar li
b\jxl-2.6.10.jar lib\mail.jar lib\o2LicenseSecurity.jar lib\png-encod
er-1.5.jar lib\poi-3.7-20101029.jar lib\poi-ooxml-3.7-20101029.jar li
b\poi-ooxml-schemas-3.7-20101029.jar lib\swing-worker.jar lib\swingx-
0.9.0.jar lib\synthetica.jar lib\tpkutils.jar lib\ucanaccess-2.0.9.2.
jar lib\xbean.jar
|
|
|
|
|
It is clearly in the lib directory. However since that is a relative path and you have given no indication where it is rooted, we cannot tell. Try using Windows Explorer to search for it.
|
|
|
|
|
I want to delete element n and m in the array.
public static void main(String[] args)
{
int number=0;
String [] names = {"Pedro","Maria", "Nancy","Pinto" };
for (int i =0; i < names.length; i++) {
names[number]=names[i];
}
number--;
System.out.println(Arrays.toString(names));
}
|
|
|
|
|
Not sure what exactly you mean but your code makes no sense. You should not be using arrays for such a construct, but one of the Java Collection Classes[^].
|
|
|
|