我正在尝试编译我的maven
项目,Java 10
但我遇到了麻烦.在我的IDE(IntelliJ IDEA
)中,所有内容都编译并运行得很好Java 10
.我安装了最新maven
版本3.5.4
并指出JAVA_HOME
了JDK 10
:
$ mvn --version
Apache Maven 3.5.4 (1edded0938998edf8bf061f1ceb3cfdeccf443fe; 2018-06-17T20:33:14+02:00)
Maven home: C:\Maven\bin\..
Java version: 10.0.2, vendor: Oracle Corporation, runtime: C:\Program Files\Java\jdk-10.0.2
Default locale: en_US, platform encoding: Cp1252
OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"
Run Code Online (Sandbox Code Playgroud)
maven
我使用的命令是:
mvn package -Dmaven.test.skip
Run Code Online (Sandbox Code Playgroud)
在我,pom.xml
我有以下Java 8
工作正常:
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<libraries.directory>libraries</libraries.directory>
</properties>
Run Code Online (Sandbox Code Playgroud)
因为Java 10
我把它改成了以下内容:
<maven.compiler.source>10</maven.compiler.source>
<maven.compiler.target>10</maven.compiler.target> …
Run Code Online (Sandbox Code Playgroud) 我正在使用IntelliJ开发Java
桌面应用程序.在我的项目中,我添加了框架支持Maven
并在pom.xml
文件中添加了依赖项.我还添加了这里描述的构建工件(如果这个问题得到解答,我也很感激).现在我的项目有了Maven
支持,生成的JAR
文件不再有效.当我尝试启动它时,它会显示错误Error: Invalid or corrupt jarfile MyProject.jar
.当我使用打开JAR
文件时WinRAR
,没有MANIFEST.MF
包含文件,只有文件夹和CLASS
文件.我的Maven
依赖项发生了什么变化?为什么没有通过其工件IntelliJ
将我的Maven
项目正确地构建到可执行JAR
文件中?
我正在尝试使用Java 1.8
lambda表达式Idea UI Designer
,我在maven中:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>ideauidesigner-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>javac2</goal>
</goals>
</execution>
</executions>
<configuration>
<fork>true</fork>
<debug>true</debug>
<failOnError>true</failOnError>
</configuration>
</plugin>
Run Code Online (Sandbox Code Playgroud)
和依赖
<dependency>
<groupId>com.intellij</groupId>
<artifactId>forms_rt</artifactId>
<version>7.0.3</version>
</dependency>
Run Code Online (Sandbox Code Playgroud)
当我尝试使用lambdas时,它返回编译错误:
Failed to execute goal org.codehaus.mojo:ideauidesigner-maven-plugin:1.0-beta-1:javac2 (default) on project stockbox-chart: Execution default of goal org.codehaus.mojo:ideauidesigner-maven-plugin:1.0-beta-1:javac2 failed: 52264 -> [Help 1]
Run Code Online (Sandbox Code Playgroud)
你有什么想法如何使用lambdas Idea UI Designer
?
我有一些示例代码使用OpenCV(Java包装器)将2个图像拼接在一起.它引用了一个不推荐使用的类"DescriptorExtractor".我在官方网站文档或源代码中找不到任何关于我应该使用的信息.当某些东西被弃用时,我总是很生气,而且它并没有告诉你应该使用什么.
谁能帮我?
我正在使用OpenCV 3.4.1和预构建的Windows库.
该课程的官方文档似乎在这里.
"FeatureDetector"类同样被弃用,同样没有任何关于使用什么的提示.
我正在编写一个Java
自动构建和运行SQL查询的应用程序.对于许多表我的代码工作正常,但在某个表上它会因抛出以下异常而卡住:
Exception in thread "main" org.postgresql.util.PSQLException: ERROR: column "continent" does not exist
Hint: Perhaps you meant to reference the column "countries.Continent".
Position: 8
Run Code Online (Sandbox Code Playgroud)
已运行的查询如下:
SELECT Continent
FROM network.countries
WHERE Continent IS NOT NULL
AND Continent <> ''
LIMIT 5
Run Code Online (Sandbox Code Playgroud)
这实质上5
从列中返回非空值.
我不明白为什么我在pgAdmin 4中明显地出现"列不存在"错误.我可以看到有一个名称Network
包含表的模式countries
,该表有一个名称Continent
与预期一样的列.
由于应用程序本身检索了所有列,模式和表名称,我认为没有拼写或语义错误,为什么PostgreSQL会导致问题呢?在pgAdmin4中运行查询也不使用建议countries.Continent
的工作.
我的PostgreSQL版本是迄今为止的最新版本:
$ psql --version
psql (PostgreSQL) 9.6.1
Run Code Online (Sandbox Code Playgroud)
如何成功运行查询?
我想找到我当前使用Java代码连接的本地网络中设备的所有IP地址.有用的实用程序Advanced IP Scanner
能够在我的子网中找到各种IP地址192.168.178/24
:
根据这个答案,我按以下方式构建了我的代码:
import java.io.IOException;
import java.net.InetAddress;
public class IPScanner
{
public static void checkHosts(String subnet) throws IOException
{
int timeout = 100;
for (int i = 1; i < 255; i++)
{
String host = subnet + "." + i;
if (InetAddress.getByName(host).isReachable(timeout))
{
System.out.println(host + " is reachable");
}
}
}
public static void main(String[] arguments) throws IOException
{
checkHosts("192.168.178");
}
}
Run Code Online (Sandbox Code Playgroud)
不幸的是,这不会打印出任何结果,这意味着无法访问任何IP地址.为什么?我的本地网络中有设备,如Advanced IP Scanner
扫描中所见.
我正在编写C
代码并为PowerPC
架构编译它.该C
代码包含浮点变量常量,我希望将其放在该.text
部分中,而不是.rodata
功能代码是自包含的.
这个问题在于PowerPC
,将浮点值移动到浮点寄存器的唯一方法是从内存加载它.这是一个指令集限制.
为了说服GCC
帮助我,我尝试将浮标声明为static const
.没有不同.使用指针,结果相同.使用__attribute__((section(".text")))
该功能,相同的结果和每个浮点变量分别:
error: myFloatConstant causes a section type conflict with myFunction
Run Code Online (Sandbox Code Playgroud)
我也试过通过#pragma GCC push_options
#pragma GCC optimize("O0")
和禁用优化#pragma GCC pop_options
.再假装我有一个unsigned int
工作:
unsigned int *myFloatConstant = (unsigned int *) (0x11000018);
*myFloatConstant = 0x4C000000;
Run Code Online (Sandbox Code Playgroud)
使用浮点数:
float theActualFloat = *(float *) myFloatConstant;
Run Code Online (Sandbox Code Playgroud)
我仍然想保留,-O3
但它再次使用,.rodata
所以一个潜在的答案将包括哪个优化标志导致浮动被放置,.rodata
因为从这开始-O1
发生?
最好的情况是我可以在代码中"正常"使用浮点数加上最大优化,但它们根本就不会被放置.rodata
.
我想象 …
我正在尝试按整数解析二进制文件,以检查整数值是否满足某个条件,但循环非常慢。
此外,我发现memory-mapped file
s 是将文件快速读入内存的最快方法,因此我使用了以下Boost
基于代码的代码:
unsigned long long int get_file_size(const char *file_path) {
const filesystem::path file{file_path};
const auto generic_path = file.generic_path();
return filesystem::file_size(generic_path);
}
boost::iostreams::mapped_file_source read_bytes(const char *file_path,
const unsigned long long int offset,
const unsigned long long int length) {
boost::iostreams::mapped_file_params parameters;
parameters.path = file_path;
parameters.length = static_cast<size_t>(length);
parameters.flags = boost::iostreams::mapped_file::mapmode::readonly;
parameters.offset = static_cast<boost::iostreams::stream_offset>(offset);
boost::iostreams::mapped_file_source file;
file.open(parameters);
return file;
}
boost::iostreams::mapped_file_source read_bytes(const char *file_path) {
const auto file_size = get_file_size(file_path);
const auto mapped_file_source = read_bytes(file_path, 0, …
Run Code Online (Sandbox Code Playgroud) 当我在我的中Visual Studio Enterprise 2017
创建时,我立即收到以下错误页面(而不是设计器页面):
Windows Form
solution
堆栈跟踪是:
at Microsoft.VisualStudio.LanguageServices.CSharp.CodeModel.CSharpCodeModelService.GetTypeSymbolFromFullName(String fullName, Compilation compilation)
at Microsoft.VisualStudio.LanguageServices.Implementation.CodeModel.RootCodeModel.DotNetNameFromLanguageSpecific(String languageName)
at EnvDTE80.CodeModel2.DotNetNameFromLanguageSpecific(String LanguageName)
at Microsoft.VisualStudio.Design.Serialization.CodeDom.VSCodeDomParser.CodeTypeDeclarationFromCodeClass(CodeClass vsClass)
at Microsoft.VisualStudio.Design.Serialization.CodeDom.VSCodeDomParser.OnNamespacePopulateTypes(Object sender, EventArgs e)
at System.CodeDom.CodeNamespace.get_Types()
at Microsoft.VisualStudio.Design.Serialization.CodeDom.VSCodeDomParser.Parse(TextReader codeStream)
at Microsoft.VisualStudio.Design.Serialization.CodeDom.MergedCodeDomParser.System.CodeDom.Compiler.ICodeParser.Parse(TextReader stream)
at System.CodeDom.Compiler.CodeDomProvider.Parse(TextReader codeStream)
at Microsoft.VisualStudio.Shell.Design.Serialization.CodeDom.CodeDomDocDataAdapter.get_CompileUnit()
at Microsoft.VisualStudio.Design.Serialization.CodeDom.VSCodeDomDesignerLoader.PerformLoad(IDesignerSerializationManager serializationManager)
at Microsoft.VisualStudio.Design.Serialization.CodeDom.VSCodeDomDesignerLoader.DeferredLoadHandler.Microsoft.VisualStudio.TextManager.Interop.IVsTextBufferDataEvents.OnLoadCompleted(Int32 fReload)
Run Code Online (Sandbox Code Playgroud)
页面上提供的链接没有帮助,因为它们仅链接到通用文档/帮助页面。如何修复此错误?
c# windows-forms-designer visual-studio winforms visual-studio-2017
我读到Visual Studio
现在支持跨平台开发。到目前为止,我正在使用和(using )CMake
进行编译。然而,似乎没有任何关于如何使用target实际完成交叉编译的信息。可以用吗?根据这篇文章,您可以选择和as ,但这些选项甚至对我来说都不可用,也不是。Windows
Ubuntu
WSL
Visual Studio
Mac OS X
CMakeSettings.json
Linux-Debug
Linux-Release
configurationType
Visual Studio 2017 Enterprise
Linux
Mac OS X
我可能只是按照这篇文章中的建议设置一个虚拟机,这似乎是完成工作的最方便的解决方案。