I'm having a problem running someones code in Eclipse 3.6 (Helios). The code is written with OpenJDK 7. I'm running Windows 7 and I had to install Java 7 for it. I was using Java 6 before. I get 2 kinds of errors running the code:
"Cannot cast from Object to int" (also: double, long, boolean)
"Cannot instantiate the type HashSet<?>"
I read casts like "(int) obj" are only possible in Java 7. In Java 6 it has to be "(Integer) obj" instead. But I set the "JRE System Library" to JRE7 and I still get that error. Is it still somehow using JRE6?
The second problem is caused by "Set set; set = new HashSet<>()". The problem is gone if you replace HashSet<>() with HashSet<String>(). Is this another Java 7 change? And why is it not working with my JRE7? Is my Eclipse too old and only able to run JRE6?
Thanks in advance,
Torben
You're describing new features in the Java 7 compiler.
You need to use the Java 7 compiler, with any version of the JRE.
Related
Hi I have a big problem: We created a program in C++/Qt 4.8.4 /Qt Creator 2.8.1 years ago that while executing runs another executable (written and compiled in FORTRAN). Everything worked well.
We recompiled our Fortran-Code with the new version of Visual studio and now suddenly it doesn`t work any more. I looked into my C++-Code and found the position where the program crashes:
std::string Executable = ApplicationName.toStdString();
bool RunOK= system((Executable+" > "+"X.out2").c_str());
QString ExeName = (Executable+" > "+"X.out2").c_str();
QString tf = QString::number(qweee);
if(system((Executable+" > "+"X.out2").c_str()))
{
msg.showMessage("msg.showMessage("An XXX error occured during calculation......((Executable+ > +X.out2).c_str(): "+ExeName +"......(system((Executable+ > +X.out2).c_str()): "+ QString::number(RunOK));
if(QFile(OutputFiles[0]).exists())
QFile(OutputFiles[0]).remove();
}
Somehow system((Executable+" > "+"X.out2").c_str()) gets to be true which didn`t happen before.
This seems to happen either in the c_str-command or in the system()-command.
We had some missing dll-issues before. Is this another dll-problem and if so which?
Can anybody help us on this?
Thank you
The return value of system is an integer, not a boolean. Its value is only defined for one very special case, system(nullptr). That's not the case here. So whether you get a zero or non-zero result depends on your particular C++ implementation, which has indeed changed. ("New visual studio version"). You can't rely on non-zero means error
c_str() is not a suspect at all.
I red the following article and it seems like I should be able to define a variable of type varying that's size limit will be 16mb instead of 65535 characters.
http://www.mcpressonline.com/programming/rpg/v6r1-rpg-enhancements.html
This forum post suggests that it is posible to do this in V6.1.
http://www.code400.com/forum/forum/iseries-programming-languages/rpg-rpgle/11426-character-string-max-length
D BigVarying S a Len(25000000) Varying(4)
When I try to implement this I get the following errors and it seems like I cannot use Len(25000000) Varying(4)
Maybe I don't understand what exactly is meant by V6.1 but I checked on the Green screen using the command DSPSFWRSC and get the following Release V6R1..
I also checked by using I systems navigator and I checked the servers properties and it is : i5/OS version Version 6 Release 1 Modification 0.
The IDE I use to compile is IBM Websphere development studio
Version: 7.0.0
Build id: 20070202_0030
Trying to compile a RPGLE function.
Am I checking the correct version or is there a RPG version and how do you check it.
can you please help me out of my confusion.
V6.1 is your operating system version and you can refer to the V6.1 ILE RPG Language Reference here to see if it's possible. I think what you're looking for is on page 185.
I've just tested this in 7.2 and I am not getting the same errors.
D BigVarying S a Len(25000000) Varying(4)
RNF0501E Length of character item exceeds 16773104; length defaults to 16773104.
RNF0231E Length of varying length character item exceeds 16773100; length defaults to 16773100.
//Dcl-S BigVarying Varchar(25000000);
BigVarying = 'Hello world';
Return;
So, as the (duplicate) error mentions
Length of character item exceeds 16773104; length defaults to 16773104.
If you'd like a bigger length you'll need to update to a newer version of IBM i - but the max length is also 16773104, meaning 25000000 is invalid.
While RPGLE supports 16MB variables from 6.1 forward and you are on 6.1..
You have two problems:
25000000 (23.8MB) is bigger than 16773104 (~16MB)
Websphere Development Studio v7 (WDSc) is older than IBM i 6.1 (your build date is 2007, the article you're referencing came out in 2008). So your IDE doesn't recognize the new keywords and new max size.
Problem #2 isn't a deal breaker, you can simply ignore the errors in the IDE and compile on ther server successfully. If you were using the green screen editor SEU, you'd have to do the same as IBM stopped enhancing SEU at 6.1.
Using this method
getServletContext().getRealPath("/")
returns '\' at the end when i run my project in Tomcat 7 whereas it is not working as such in Tomcat 8.
For example,
In Tomcat 7 it returns as "D:\Tomcat\webapps\project\"
In Tomcat 8 it returns as "D:\Tomcat\webapps\project"
At present the project is in production so, I am unable to change the code in every part(where i use getRealPath("/")). Is there a way/setting in tomcat level to make it resolved.
This issue has been Fixed in trunk for 9.0.x and in 8.0.x for 8.0.19 onwards.
For your reference,
https://bz.apache.org/bugzilla/show_bug.cgi?id=57556
Using the ICU library with C++ I'm doing:
char const *lang = Locale::getDefault().getLanguage();
If I write a small test program and run it on my Mac system, I get en for lang. However, inside a larger group project I'm working on, I get root. Anybody have any idea why? I did find this:
http://userguide.icu-project.org/locale/resources
so my guess is that, when running under the larger system, some ICU resources aren't being found, but I don't know what resources, why they're not being found, or how to fix it.
Additional Information
/usr/bin/locale returns:
LANG="en_US.ISO8859-1"
LC_COLLATE="C"
LC_CTYPE="C"
LC_MESSAGES="C"
LC_MONETARY="C"
LC_NUMERIC="C"
LC_TIME="C"
LC_ALL="C"
If I write a small C program:
char const *lang = setlocale( LC_ALL, "" ):
I get en_US.ISO8859-1.
OS: Mac OS X 10.6.4 (Snow Leopard)
ICU version: 4.3.4 (latest available via MacPorts).
A little help? Thanks.
root is surely an odd default locale - you don't see many native root-speakers these days.
But seriously, is it safe to assume on the larger system that someone hasn't called one of the variants of setDefault("root")?
What does something like /usr/bin/locale return on this system (if you can run that)?
ICU 4.4 now has a test program called 'icuinfo', does it also return root as the default locale?
What OS/platform is this on, and which version of ICU?
The following code produces an error hr=0x80020005 (wrong type).
#import <msi.dll>
using namespace WindowsInstaller;
main()
{
::CoInitialize(NULL);
InstallerPtr pInstaller("WindowsInstaller.Installer");
DatabasePtr pDB = pInstaller->OpenDatabase(
"c:\\foo\\bar.msi",
msiOpenDatabaseModeTransact);
}
I think the reason is that behind the scene, there is MsiOpenDatabase(), which
take a LPCTSTR as second argument.
This second argument can be MSIDBOPEN_TRANSACT whose definition is
#define MSIDBOPEN_TRANSACT (LPCTSTR)1
I do not know if it is possible to give a variant with the good inner type as second argument. The _variant_t constructor does many checks, so I can't disguise an int into
a char* so easily.
Has anyone tried to use this method in C++?
Edit:
My version of msi.dll is 3.1.4000.2805, my system is XP SP 2, and the code is supposed to run on any machine with XP or Vista.
urls to MSDN articles are welcome.
On the same machine, the call to the low-level equivalent:
MsiOpenDatabase("c:\\foo\\bar.msi", MSIDBOPEN_TRANSACT);
works perfectly.
I finally got the answer on msdn forums
DatabasePtr pDB = pInstaller->OpenDatabase(
"c:\\foo\\bar.msi",
(long)msiOpenDatabaseModeTransact);
MSDN says OpenDatabase is available from MSI version 4.0 onwards, transactions in general from MSI 4.5 onwards. Just a hunch, but could it be that your MSI is outdated? I once had some mysterious trouble with an outdated MSI version.