|
I just created 2 new VM's (Windows 10 x64), in one I installed Java SE 8 with Visual Studio, and I was getting the same thing, class not found, then I installed Java SE 17 and just like on host, no problem it is running fine.
Then on the second machine I installed Java from oracle ^, which the user would do, and copied the working executable (with no errors) to it (after installing needed redistributable of curse) but I'm getting "jvm.dll" not found error.
|
|
|
|
|
I just installed the 1.8 version of Java and rebuilt my project and it works fine. Have you checked that you are not trying to mix x86 and x64 code? Version 17 is x64 only, but 1.8 offers both. So if you have the x86 version installed that could be the problem.
|
|
|
|
|
Yeah, to be sure there isn't a problem with the installation, I even just uninstalled everything Java related, and reinstalled them. I don't even have a folder in "Program files (x86)", and in x64 I have these only 17 and 1.8 (and what I'm working on right now it is for x64 only anyway):
https://i.ibb.co/X3xcDcf/image.png[^]
When I have in PATH location from 1.8:
https://i.ibb.co/K0vzM4J/image.png[^]
And when I have in PATH location from 17:
https://i.ibb.co/d23HNTv/image.png[^]
It is the project from that tutorial with unmodified files. I even did some Java socket call tests from C++ and they worked fine with 17. That is kinda the main reason I need this Java/C++ combination for, as I already have some systems made in Java that this new project (made in Unreal Engine which is C++) will relay on.
modified 15-Jun-22 15:36pm.
|
|
|
|
|
Make sure that you build the C++ part and the Java part with the same version of Java, they may not be fully compatible across different versions. Also, rather than using pictures to post simple text information, please use copy and paste and add it to your question.
|
|
|
|
|
Yeah that was the problem for saying that it can't find the class, I just added target and source and now it is working, but the second part is still a problem. I copied the released executable and the class file to a freshly created VM with only Java and redistributable installed and I'm getting the same error:
Example3.exe - System ErrorThe code execution cannot proceed because jvm.dll was not found. Reinstalling the program may fix this problem.
Off topic: They should add an image preview, because those are really useful.
|
|
|
|
|
Valentinor wrote: The code execution cannot proceed because jvm.dll was not found. I think I have answered that more than once.
Valentinor wrote: They should add an image preview This has been rejected a number of times as it would be open to abuse by spammers.
|
|
|
|
|
Richard MacCutchan wrote: If the customer correctly installs the Java runtime then it will set the PATH variable with the correct details. Your code should then run correctly. I have done a test on my system and that is all that is needed as far as I can tell.
You did said this, and I've done it, even on 2 new separate VM's, installed Java and needed redistributable and on both I get the same error.
|
|
|
|
|
So you keep saying. But I cannot see what is happening on your system. I have tried multiple tests of this issue with Java versions 1.8, 14 and 17 and cannot recreate the problem you are having.
|
|
|
|
|
|
I owe you an apology.
I do not have a VM to run this on so my reinstalls of Java were missing something that I had set up in the past. The jvm.dll is not in the bin directory of the JRE installation, but in a subdirectory named server. This was in my PATH variable and was not removed when I uninstalled one of the Java versions. So you need to add that location to the PATH variable manually. Sorry again for the confusion.
|
|
|
|
|
The thing is that when Java is installed it doesn't add some kind of dynamic link in PATH to where jvm.dll is located, well it doesn't add one at all.
Yes, if I'm compiling the class with 1.8 and then on VM I can manually add in PATH the server folder, but here is a problem, the user should not go though this process of opening variables and find PATH to add it there.
A solution would be that when the app is opened, it would check if Java in installed, if it is not, then the user would be prompted to download it, or I have to search and see if you can legally distribute JavaSetup8uxxx.exe file and if you can the app would automatically run the file and the user would go though the process of installing Java. After Java is installed by either way then the app will search what version is installed to know what location to add in PATH, which it would do after knowing that. At this point the app will run fine.
BUT then you run into another problem, if the user updates Java then the location will change for jvm.dll , so you would have to add another variable to PATH with the new location for it, and remove the old one.
Adding a variable to PATH shouldn't be a problem, as Java and other programs do it too, I'll just have to see how that is done from C++ code.
If this is actually the only way to do it, then I guess I can do it this way, but having another solution that wouldn't involve adding variables to PATH would have been better.
|
|
|
|
|
I have tried a couple of ideas, and looked again at the documentation, but I cannot find a simple answer. It would appear that there is no simple method of installing this on a user's system, other than what you have already discovered.
|
|
|
|
|
I have been working on a possible answer to this. If you send me a personal email (see the link below this message) I can let you have the details, and the code.
One of the things I have discovered is the the jvm.dll must be the same version as that of the javac compiler that buiolds the class file(s).
|
|
|
|
|
I don't see any link it might have been cut, or it is hidden, but this is an old email I have that I don't care about spam so it is fine to make it public:
Email removed
modified 17-Jun-22 11:03am.
|
|
|
|
|
Hi
I am adding a string to listbox as a 8 bit ansi string for example the string is "8FED90" ending with a null
however when the MeasureItem method is called
itemData points to the string as wide so it display in memory as 38 00 46 00 45 00 44 00 39 00 30 00
I have Character set as "NOT SET" in my property pages -> Advanced in Visual Studio
Thanks
|
|
|
|
|
That does not make sense. The data pointed to by the MEASUREITEMSTRUCT is what you have set when you create the control. However, whether it is ANSI or Unicode does not matter, as the actual display dimensions will be the same.
|
|
|
|
|
Use an input file
An instructor has asked you to write a program that can tell him if his students have passed or
failed his course. He has a file that contains the following information:
• first name
• last name
• five quiz grades
• the midterm exam grade
• the final exam grade
Your program must read these values into variables then use those variables to calculate the
final average and finally display that average to the screen.
Requirements:
1. All input comes from a file – grades.txt. You may NOT ask for input from the professor. This
file is posted on Canvas for your program to use.
2. Remember: Your program must calculate the final average including those quizzes. All the
quizzes averaged together count as much as a test. So, to calculate the final, you need to
calculate the quiz average first, then average the midterm + final + quiz average.
3. Display the student’s last name first, comma, space and first name. Follow that with the final
average as a whole number, rounded up
The file contains one line of data in the following order:
firstName lastName q1 q2 q3 q4 q5 midterm final
Remember, data must be read in sequentially! This means that the first name variable must be
initialized before the last name or the quiz one and etc.
Code:
#include <iostream>
#include <fstream>
using namespace std;
/* run this prgram using the console pauser or add your own getch, system('pause") or input look */
int main(int argc, char** argv)
{
string firstName,lastName;
int q1, q2, q3, q4, q5, midterm, final;
int quizaverage;
int average;
ifstream inFile;
inFile.open("grades.txt");
inFile>>firstName>>lastName>>q1>>q2>>q3>>q4>>q5>>midterm>>final;
//Calculate the quiz average.
quizaverage=(q1+q2+q3+q4+q5)/5;
average=(quizaverage+midterm+final)/3*100;
cout<<"Dobbs, Bob"<<" Average: "<<average;
inFile.close();
return 0;
I need help with this. I am trying to use the numbers given from a text file in the program.
|
|
|
|
|
Stephanie Foley wrote: I need help with this Exactly what help do you need?
|
|
|
|
|
I need to use an input file to find that course average. The course average is a mathematical expression involved in quiz average, midterm grade, and final grade. I am trying to get the program to read what is in the file. There is the first name, last name, and 7 numbers. I need to use these values in the program to get an average for the class.
-- modified 6-Jun-22 16:22pm.
|
|
|
|
|
Well you stated that in your original question. But you have still not explained what your problem is.
|
|
|
|
|
How are your results different from what is expected? Also, showing the files exact contents would be helpful.
"the debugger doesn't tell me anything because this code compiles just fine" - random QA comment
"Facebook is where you tell lies to your friends. Twitter is where you tell the truth to strangers." - chriselst
"I don't drink any more... then again, I don't drink any less." - Mike Mullikins uncle
|
|
|
|
|
I found, a statement,
int &a = 1;
the statement can be built in QT Creator, mingw_64.
while on Programiz: Learn to Code for Free[^]
Got,
gcc /tmp/BlXEG8NqhU.c -lm
/tmp/BlXEG8NqhU.c: In function 'main':
/tmp/BlXEG8NqhU.c:6:15: error: expected identifier or '(' before '&' token
6 | const int &a = 2;
so the int &a = 1;
is that right?
a is a bias name of "1" in rodata?
|
|
|
|
|
I suspect that whatever QT Creator is doing is somehow creating a const reference . e.g.
int &a = 1; const int &b = 2;
Consider what int &a = 1 means: I.E. create a reference to the integer 1. If that were to compile successfully then consider
int &a = 1;
a = 2;
std::cout << 1 + 1 << '\n'; By the rules of C++, at least as I understand them, that should print 4, since you've changed the value of 1 to 2 at the assignment statement.
Keep Calm and Carry On
|
|
|
|
|
You are trying to use a C++ construct in a C-language program.
|
|
|
|
|
is a floating point number still considered a number? I`m talking about a number that is not whole. Like for instance 0.01 feels like less than a 'number'
|
|
|
|